how to give column names for a data in R
hello,
I have a file with 1117 columns and I have the names of these columns but how to give the names to those columns
it is not efficient to write
colnames(data)=c("name1", "name2",.....) because they are 1117 names
any help
• 26 views
•
link
0 answers
No answers yet.
Log in to answer this question.
If you have the names of these columns in a file, you can load the file, extract the column names from what you loaded, and use this for
colnames. Alternatively, if the column names are organised in a systematic way, you can construct them with combinations of commands such aspasteorrep. For instance, in your example above, c("name1", "name2") can be constructed withpaste("name", 1:2, sep="").