[R] Assigning variable names from one object to another object
Sunita22
sunitap22 at gmail.com
Sun May 24 18:21:46 CEST 2009
Hello
I have 2 datasets say Data1 and Data2 both are of different dimesions.
Data1:
120 rows and 6 columns (Varname, Vartype, Labels, Description, ....)
The column Varname has 120 rows which has variable names such id, age,
gender,.....so on
Data2:
12528 rows and 120 columns
The column names in this case are V1, V2, ......... V120 (which are default
names in R when we say head=F in read.csv)
I want to assign the variable names from Data1 to Data2 as the column
headings in Data2 i.e V1 should be id, V2 should be age, ...... so on
Is it possible to do in R?
I tired assigning variable names from Data1 in one object and transposing
them and then used rbind but it doesnot work.
Can I use colnames? I could not apply it in this case. Can any1 tell me how
can i apply it for this case?
or should I paste the column names in csv file (from where I have imported
the data) and then import in R?
Thank you in advance
Regards
Sunita
--
View this message in context: http://www.nabble.com/Assigning-variable-names-from-one-object-to-another-object-tp23695359p23695359.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list