How to Rename a Column Name in R | 3 Examples to Change Colnames of a Data Frame
37.4 هزار بار بازدید -
6 سال پیش
-
In this video I'm showing
In this video I'm showing you how to rename column names of an R data frame (3 example codes).
For more information, visit my homepage: https://statisticsglobe.com/rename-co...
In the following video description, you can find the whole R code of the video. Just copy and paste it to your own R or RStudio software and run the code.
##### Load data #####
data("airquality")
head(airquality)
##### Rename one column name #####
colnames(airquality)[colnames(airquality) == "Day"] <- "Day_of_the_Week"
##### Rename all column names #####
colnames(airquality) <- c("var1", "var2", "var3", "var4", "var5", "var6")
##### Rename some column names #####
colnames(airquality)[colnames(airquality) %in% c("var1", "var3")] <- c("Sun", "Storm")
For more information, visit my homepage: https://statisticsglobe.com/rename-co...
In the following video description, you can find the whole R code of the video. Just copy and paste it to your own R or RStudio software and run the code.
##### Load data #####
data("airquality")
head(airquality)
##### Rename one column name #####
colnames(airquality)[colnames(airquality) == "Day"] <- "Day_of_the_Week"
##### Rename all column names #####
colnames(airquality) <- c("var1", "var2", "var3", "var4", "var5", "var6")
##### Rename some column names #####
colnames(airquality)[colnames(airquality) %in% c("var1", "var3")] <- c("Sun", "Storm")
6 سال پیش
در تاریخ 1397/07/07 منتشر شده
است.
37,435
بـار بازدید شده