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