Drop Multiple Columns from Data Frame Using dplyr Package in R (Example) | select & one_of Functions

Описание к видео Drop Multiple Columns from Data Frame Using dplyr Package in R (Example) | select & one_of Functions

How to remove multiple variables from data frame using the dplyr package in the R programming language. More details: https://statisticsglobe.com/drop-mult...
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:   / joachimschork  
Facebook:   / statisticsglobecom  
Reddit:   / joachimschork  
Pinterest: https://www.pinterest.de/JoachimSchork

Комментарии

Информация по комментариям в разработке