How to rename a single column in an R data frame?
https://www.tutorialspoint.com/how-to-rename-a-single-column-in-an-r-data-frame
-
13-09-2020 - |
سؤال
How to rename a single column in an R data frame?
We can do this by defining the newname as shown below −
> Samp <- data.frame(sample(1:100,10)) > Samp sample.1.100..10. 1 47 2 63 3 57 4 16 5 53 6 7 7 54 8 2 9 13 10 14 > colnames(Samp) <- "Sampled Values" > Samp Sampled Values 1 47 2 63 3 57 4 16 5 53 6 7 7 54 8 2 9 13 10 14
Since we only have one column in the data frame, so it is sufficient to use the object name.
Advertisements
لا تنتمي إلى Tutorialspoint