Data Science Desktop Survival Guide
by Graham Williams |
|||||
Privacy Setup |
20200514 Packages used in this chapter include magrittr, and rattle.
Packages are loaded into the currently running R session from your
local library directories on disk. Missing packages can be installed
using utils::install.packages() within R. On Ubuntu, for
example, 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.
The rattle::weatherAUS dataset is loaded into the template variable ds and further template variables are setup as introduced in Williams (2017). See Chapter 7 for details.
|
dsname <- "weatherAUS"
ds <- get(dsname) 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.
|
form
|
ds %>% sample_frac()
|