Re: [R] Changing data frame column headings

2012-12-05 Thread arun
4  7  13 #2  11  9  16 A.K. - Original Message - From: Rich Shepard To: r-help@r-project.org Cc: Sent: Wednesday, December 5, 2012 4:23 PM Subject: Re: [R] Changing data frame column headings On Wed, 5 Dec 2012, R. Michael Weylandt wrote: > Can you be more explicit about your problem? Mi

Re: [R] Changing data frame column headings

2012-12-05 Thread arun
Hi Rich, You can get ?rename() by either loading library(reshape) or library(plyr). A.K. - Original Message - From: Rich Shepard To: R help Cc: Sent: Wednesday, December 5, 2012 4:24 PM Subject: Re: [R] Changing data frame column headings On Wed, 5 Dec 2012, arun wrote: > I am

Re: [R] Changing data frame column headings

2012-12-05 Thread Rich Shepard
On Wed, 5 Dec 2012, David L Carlson wrote: names(a) <- gsub("_quant", "", names(a)) a David, I did not pick that up from the names() help page. Thanks for the insight. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

Re: [R] Changing data frame column headings

2012-12-05 Thread Rich Shepard
On Wed, 5 Dec 2012, arun wrote: You can get ?rename() by either loading library(reshape) or library(plyr). A.K. I wondered about that, but assumed that reshape functions would also be found in reshape2. I now know that's not the case. :-) Much appreciated, Rich __

Re: [R] Changing data frame column headings

2012-12-05 Thread David L Carlson
Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rich Shepard > Sent: Wednesday, December 05, 2012 3:25 PM > To: R help > Subject: Re: [R] Changing data frame column headings > > On Wed, 5 Dec 2012, arun wrote: > &

Re: [R] Changing data frame column headings

2012-12-05 Thread R. Michael Weylandt
On Wed, Dec 5, 2012 at 9:23 PM, Rich Shepard wrote: > On Wed, 5 Dec 2012, R. Michael Weylandt wrote: > >> Can you be more explicit about your problem? > > > Michael, > > Data frame contains water chemistry data; site, date, parameter, value. > The column names after dcast() are, for example, alk

Re: [R] Changing data frame column headings

2012-12-05 Thread Rich Shepard
On Wed, 5 Dec 2012, arun wrote: I am not sure why ?rename() is not working.  a <- list(a = 1, b = 2, c = 3)      rename(a, c(b = "a", c = "b", a="c")) I have the reshape2 library loaded and ?rename did not find the help page. Are the parentheses required in the command? Thanks, Rich _

Re: [R] Changing data frame column headings

2012-12-05 Thread Rich Shepard
On Wed, 5 Dec 2012, R. Michael Weylandt wrote: Can you be more explicit about your problem? Michael, Data frame contains water chemistry data; site, date, parameter, value. The column names after dcast() are, for example, alk_quant, ph_quant, tds_quant. I wanted to remove the '_quant' from

Re: [R] Changing data frame column headings

2012-12-05 Thread arun
Hi, I am not sure why ?rename() is not working.  a <- list(a = 1, b = 2, c = 3)      rename(a, c(b = "a", c = "b", a="c")) A.K. - Original Message - From: Rich Shepard To: r-help@r-project.org Cc: Sent: Wednesday, December 5, 2012 1:51 PM Subjec

Re: [R] Changing data frame column headings

2012-12-05 Thread R. Michael Weylandt
x <- data.frame(a = 1:5, b = rnorm(5)) names(x) <- LETTERS[2:1] print(x) seems to work. Can you be more explicit about your problem? Michael On Wed, Dec 5, 2012 at 6:51 PM, Rich Shepard wrote: > I have a reshaped data frame with value column headings concatenated from > two column headings

[R] Changing data frame column headings

2012-12-05 Thread Rich Shepard
I have a reshaped data frame with value column headings concatenated from two column headings in the melted data frame. I want to change all 56 headings in a single command, but 'names' allows me to change only one at a time. In Hadley's 2007 article on reshape in the Journal of Statistical Soft