Re: [R] Multi-word column names in a data frame

2018-09-06 Thread Jeff Newmiller
You forgot to reply-all ... I don't do private consulting, so please keep the conversation on the mailing list. Here are some ideas for extending your example. However, whether you WANT to or not, you really need to learn to manipulate your data BEFORE you give it to ggplot.

Re: [R] Multi-word column names in a data frame

2018-09-04 Thread Jeff Newmiller
a) missing ggplot2 library b) cannot word wrap in the middle of a string in R without introducing newlines c) aes is not recommended for working with string variables as names... use aes_string d) Because aes_string will parse the string, you need to add the backticks e) paste0() is a shorter v

Re: [R] Multi-word column names in a data frame

2018-09-04 Thread Jim Lemon
Hi Philip, This may work: library(dplyr) `RefDate` <- as.Date(c("2010-11-1","2010-12-01","2011-01-01")) `Number of vegetables` <- c(14,23,45) `Number of people` <- c(20,30,40) MyData <- data.frame(RefDate,`Number_of_vegetables`, `Number_of_people`,check.names=FALSE) MyVars <- c("Number of vegetab

[R] Multi-word column names in a data frame

2018-09-04 Thread philipsm
I am having trouble working with column names in a data frame. My column names are multi-word text strings and I like it that way. I want to loop through the columns, plotting graphs for each one, and I want to use the column names in the chart labels and in the file names when I save the c