Select Only Numeric Columns from Data Frame in R (Example) | Extract Variables with Base R & dplyr

preview_player
Показать описание
R code of this video:

##### Example data
x2 = LETTERS[1:5],
x3 = 2,
x4 = factor(c(1, 3, 2, 2, 1)),
stringsAsFactors = FALSE)
data # Print example data to console
str(data) # Inspect variable classes

##### Example 1
num_cols
data_num <- data[ , num_cols] # Subset numeric columns of data
data_num # Print subset to RStudio console

##### Example 2
library("dplyr") # Load dplyr
data_num2 # Print subset to RStudio console
Рекомендации по теме
Комментарии
Автор

Thank you so much man, you helped me a ton. I am just starting out coding regression models on r studio and you help me out so much. Thank you🙏🏽

djtube