This is a test version of Biostars. For the public version, visit https://www.biostars.org.
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

r

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 as paste or rep. For instance, in your example above, c("name1", "name2") can be constructed with paste("name", 1:2, sep="").

0 answers

No answers yet.

Log in to answer this question.