How to: Create column names in R / R Studio

0

If you want to create your own headers there is an easy way to do that. You can use the optional col.names argument to specify the column names.

If you want to create headers when importing use the code below:
>myData <- read.csv("noHeader.csv", header=FALSE, col.names = c("No", "yes", "another", "fourth","fifth", "just another header"))

If you want to add a header after you’ve created your data frame:

>names(data) <- c("new_name", "another_new_name")

LEAVE A REPLY

Please enter your comment!
Please enter your name here