8.8 Variable Types
# Identify the numeric variables by index.
ds %>%
sapply(is.numeric) %>%
which() %>%
intersect(inputi) %T>%
print() ->
numi
## [1] 3 4 5 6 7 9 12 13 14 15 16 17 18 19 20 21
# Identify the numeric variables by name.
ds %>%
names() %>%
magrittr::extract(numi) %T>%
print() ->
numc
## [1] "min_temp" "max_temp" "rainfall" "evaporation"
## [5] "sunshine" "wind_gust_speed" "wind_speed_9am" "wind_speed_3pm"
....
# Identify the categoric variables by index.
ds %>%
sapply(is.factor) %>%
which() %>%
intersect(inputi) %T>%
print() ->
cati
## integer(0)
# Identify the categoric variables by name.
ds %>%
names() %>%
magrittr::extract(cati) %T>%
print() ->
catc
## character(0)
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0