how to give column names for a data in R


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
Last edited:


Less is more. Stay pure. Stay poor.
per all the above, if it is an Excel file you could type Name1, Name2, Name3 and drag the corner of the box across all of the rows as a quick hack.