Syntax :
colnames(dataset name)[columnnumber] <- "New column name"
E.g
colnames(mtcars)[2] <- colnames(mtcars)[2]<-"Sample test"
I use 'mtcars' which is a default dataset available in R. You can simply type in 'mtcars' after you have logged in to R studio to get the dataset.
colnames(dataset name)[columnnumber] <- "New column name"
E.g
colnames(mtcars)[2] <- colnames(mtcars)[2]<-"Sample test"
I use 'mtcars' which is a default dataset available in R. You can simply type in 'mtcars' after you have logged in to R studio to get the dataset.
No comments:
Post a Comment