Skip to content
Prev 179038 / 398506 Next

combine column names

Dear R-list,

Is there any way I can extract part or whole column name from two
variables and combine them? Not values, but column names. 
For example,
I have data set with 70 variables. The column names are "Alfalfa",
"Corn","Soybean",..."Sunflower". After I combine the two variable (say
Alfalfa and Corn), I want to rename it as "AlfCor" or "AlfalfaCorn"
automatically not manually. 

In excel, I found the function combining two texts in individual
columns using (=A1&B1, if you want to combine texts in the two cells.).

Thank you very much in advance!

Steve Hong







437 RUSSELL LAB.
1630 LINDEN DR.
ENTOMOLOGY DEPT.
MADISON, WI, 53706
Tel: 608-263-0964
Fax: 608-262-3322