Re: [R] Changing column names by unique factor levels

2015-12-19 Thread Bert Gunter
1. Why do you think this is a "very strange" problem? 2. Your minimal example is helpful, but confusing: the entries in the 2nd table appear to have nothing to do with the first. I'll assume that it's just the *form* that you want to show. Also, your specification may be incomplete: Do the rows co

[R] Changing column names by unique factor levels

2015-12-19 Thread Abhinaba Roy
Hi R helpers, I am stuck with a very strange problem. My input data is structure(list(Date = structure(c(1447007400, 1447007400, 1447093800, 1447093800), tzone = "", class = c("POSIXct", "POSIXt")), Prod = c("Colg", "P&G", "Colg", "P&G"), Amt = c(57, 11, 62, 77), Amt1 = c(86, 72, 20, 23), Amt2 =

Re: [R] Changing column names

2010-12-31 Thread Bill.Venables
names(result) <- country should do what you want. From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Vincy Pyne [vincy_p...@yahoo.ca] Sent: 31 December 2010 16:07 To: r-help@r-project.org Subject: [R] Changing column names D

Re: [R] Changing column names

2010-12-31 Thread Jason Edgecombe
Pyne wrote: From: Vincy Pyne Subject: [R] Changing column names To: r-help@r-project.org Date: Friday, December 31, 2010, 6:07 AM Dear R helpers Wish you all a very Happy and Prosperous New Year 2011. I have following query. country = c("US", "France", "UK", &quo

Re: [R] Changing column names

2010-12-31 Thread Amy Milano
var1   var2 1  25 45 2  80    132 3 135 11 country = c("US", "Canada") colnames(df1) <- country HTH Amy --- On Fri, 12/31/10, Vincy Pyne wrote: From: Vincy Pyne Subject: [R] Changing column names To: r-help@r-project.org Date: Friday, D

Re: [R] Changing column names

2010-12-30 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Vincy Pyne > Sent: Thursday, December 30, 2010 10:07 PM > To: r-help@r-project.org > Subject: [R] Changing column names > > Dear R helpers > >

[R] Changing column names

2010-12-30 Thread Vincy Pyne
Dear R helpers Wish you all a very Happy and Prosperous New Year 2011. I have following query. country = c("US", "France", "UK", "NewZealand", "Germany", "Austria", "Italy", "Canada") Through some other R process, the result.csv file is generated as result.csv var1   var2  var3  var4   

Re: [R] changing column names in a dataframe

2010-04-06 Thread GlenB
jda wrote: > > I have imported data from an Excel spreadsheet. Columns in that > spreadsheet are named "name", "x", and "y", and several sets of those > columns appear in the worksheet. For example: > > name x y name x y > test1 1 3 test2 4 4 > test1 2 2 test2 5 5 > test1 3 1 test2 6 6

Re: [R] changing column names in a dataframe

2010-04-05 Thread Ista Zahn
If the columns are in order you can just past in the new names: Dat <- read.table(textConnection("name x y name1 x1 y1 test1 1 3 test2 4 4 test1 2 2 test2 5 5 test1 3 1 test2 6 6"), header=TRUE) closeAllConnections() x.vars <- grep("x", names(Dat)) y.vars <- grep("y", names(Dat)) names.va

[R] changing column names in a dataframe

2010-04-05 Thread jda
Hi folks, I have imported data from an Excel spreadsheet. Columns in that spreadsheet are named "name", "x", and "y", and several sets of those columns appear in the worksheet. For example: name x y name x y test1 1 3 test2 4 4 test1 2 2 test2 5 5 test1 3 1 test2 6 6 When I import these

Re: [R] Changing Column names in (Output) csv file

2009-12-16 Thread Nikhil Kaza
I am not sure why you are reading and writing from disk so many times? It will degrade performance. Also avoid loops when you can. just use ONS$labels <- paste(ONS$Var1[i], ONS$Var2[i], ONS$Var3[i], ONS $Var4[i], ONS$Var5[i], ONS$Var6[i], ONS$Var7[i], ONS$Var8[i],ONS $Var9[i], ONS$Var10[i]

[R] Changing Column names in (Output) csv file

2009-12-15 Thread Amelia Livington
Dear R helpers   Following is a part of R code.   data_lab <- expand.grid(c("R11", "R12", "R13"), c("R21", "R22", "R23"), c("R31", "R32", "R33"), c("R41", "R42", "R43"), c("R51", "R52", "R53"), c("R61", "R62", "R63"), c("R71", "R72", "R73"), c("R81", "R82", "R83"),  c("R91", "R92", "R93"), c("R