Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Exploration Setup

20200317 Packages used in this chapter include dplyr, 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(dplyr)        # Wrangling: select() sample_frac().
library(magrittr)     # Data pipelines: %>% %<>% %T>% equals().
library(rattle)       # normVarNames(). 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()

A random sample of the dataset:

ds %>% sample_frac()
## # A tibble: 176,747 x 24
##    date       location min_temp max_temp rainfall evaporation sunshine
##    <date>     <chr>       <dbl>    <dbl>    <dbl>       <dbl>    <dbl>
##  1 2013-09-03 Penrith       7.8     24.6      0          NA       NA  
##  2 2017-12-12 Cobar        20.7     37.2      0          NA       NA  
##  3 2014-12-01 WaggaWa~     17.7     33.9      3.8         5.4     10.1
##  4 2012-10-09 SalmonG~      9.4     21.8      0.4        NA       NA  
##  5 2012-06-10 WaggaWa~      0.7     16        0           1        9  
##  6 2019-01-20 GoldCoa~     21.8     29.7      0          NA       NA  
##  7 2019-03-11 Uluru        23.7     44.8      0          NA       NA  
##  8 2014-05-29 Penrith       7       22.1      0          NA       NA  
##  9 2012-10-21 Woomera      15.5     28.7      0          15.8     11  
## 10 2016-01-08 MountGa~     10.9     23.8      0           6.8     12  
## # ... with 176,737 more rows, and 17 more variables: wind_gust_dir <ord>,
....


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.