
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 data into R, into a dataframe, I end up with something
like this:

  name  x y name1  x1 y1
1 test1 1 3 test2  4  4
2 test1 2 2 test2  5  5
3 test1 3 1 test2  6  6

I -cannot- change the excel file, and must work with the data and labels as
they appear in R.  I would like to end up with a dataframe that looks more
like this:

  x-test1  y-test1  x-test2  y-test2
1 1        3        4        4
2 2        2        5        5
3 3        1        6        6

I believe this involves renaming the dataframe's columns using information
found within other columns of the dataframe.  It subsequently involves
deleting some of the (now-redundant) columns.  If anyone could offer some
helpful hints, I would be very appreciative!  Thank you in advance,
regardless of reply, for taking the time to read through my plea.

-jda
-- 
View this message in context: http://n4.nabble.com/changing-column-names-in-a-dataframe-tp1752034p1752034.html
Sent from the R help mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]

