Data Science Desktop Survival Guide
by Graham Williams
20200514 Packages used in this chapter include magrittr, and rattle.
Packages are loaded into the current R session from the local
library directories on disk. Missing packages can be installed using
utils::install.packages() within R. On Ubuntu R packages
can be installed using
wajig install r-cran-<pkgname>.
# Load required packages from local library into the R session.
library(magrittr) # Data pipelines: %>% %<>% %T>% equals().
library(rattle) # Dataset: weather.
ds <- weatherAUS
nobs <- nrow(ds)
vnames <- names(ds)
ds %<>% clean_names(numerals="right")
names(vnames) <- names(ds)
vars <- names(ds)
target <- "rain_tomorrow"
vars <- c(target, vars) %>% unique() %>% rev()
The variable form is used in this chapter as the formula describing the model to be built.
ds %>% sample_frac()