How to remove multiple variables from data frame using the dplyr package in the R programming language. More details: [ Ссылка ]
R code of this video:
data <- data.frame(x1 = 1:5, # Create data
x2 = letters[1:5],
x3 = 5,
x4 = c(3, 1, 6, 3, 7))
install.packages("dplyr") # Install dplyr package
library("dplyr") # Load dplyr
col_remove <- c("x1", "x3") # Define columns that should be dropped
data_new <- data %>% # Apply select & one_of functions
select(- one_of(col_remove))
Follow me on Social Media:
Twitter: [ Ссылка ]
Facebook: [ Ссылка ]
Reddit: [ Ссылка ]
Pinterest: [ Ссылка ]
![](https://s2.save4k.ru/pic/R3kvqItBB3o/maxresdefault.jpg)