20201022 Packages used in this chapter include dplyr (Wickham, François, et al. 2023), magrittr (Bache and Wickham 2022), randomForest (Breiman et al. 2022), readxl (Wickham and Bryan 2023), wakefield (Rinker 2020b), xlsx (Dragulescu and Arendt 2020), and rattle (G. Williams 2023).
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 also be installed using
$ wajig install r-cran-<pkgname>.
# Load required packages from local library into the R session. library(dplyr) # Wrangling: select() sample_frac(). library(magrittr) # Data pipelines: %>% %<>% %T>% equals(). library(randomForest) # Model: randomForest() na.roughfix() for missing data. library(readr) # Read/write delimited data: read_csv(). library(readxl) # Read Excel spreadsheets: read_excel(). library(wakefield) # Generate random datasets. library(xlsx) # Write Excel spreadsheets: write.xlsx() saveWorkbook(). library(rattle) # Dataset: weather.
After loading the required packages into the library we access the
rattle::weatherAUS dataset and save it into the template
ds, as per the template based approach
introduced in Graham J. Williams (2017). The dataset is modestly
large and is used extensively in this book to illustrate the
capabilities of R for the Data Scientist.
# Initialise the dataset as per the template. <- weatherAUS ds %>% sample_frac()ds
## # A tibble: 226,868 × 24 ## Date Location MinTemp MaxTemp Rainfall Evaporation Sunshine WindGustDir ## <date> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <ord> ## 1 2018-03-06 MountGi… 3 12.5 3.2 NA NA E ## 2 2022-06-11 Hobart 4.8 11.6 13.2 2.6 NA WSW ## 3 2009-09-22 MountGa… 9.8 16.9 31.4 5 8.6 W ## 4 2022-10-25 Cobar 12.5 25.5 13.4 NA NA WNW ## 5 2009-03-17 Adelaide 14.5 22.6 0.4 3 9.8 SW ## 6 2009-04-15 SydneyA… 16.2 30.1 19.4 5 10 <NA> ## 7 2014-01-30 Albany 16.2 24.1 0 7.4 12 <NA> ....
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