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

Variables and Model Target

Reviewing the variables we will note the different roles each of the variables play. Again we make use of the template in identifying variable roles. Notice the choice to place the target variable at the end of the variable list which is common practice. Loading the dataset into rattle will then automatically identify this variable as the target variable. Reverse the list to generate a stats::formula().

# Note the available variables.

vars <- names(ds) %T>% print()
##  [1] "date"            "location"        "min_temp"        "max_temp"   ...
##  [5] "rainfall"        "evaporation"     "sunshine"        "wind_gust_di...
##  [9] "wind_gust_speed" "wind_dir_9am"    "wind_dir_3pm"    "wind_speed_9...
## [13] "wind_speed_3pm"  "humidity_9am"    "humidity_3pm"    "pressure_9am...
## [17] "pressure_3pm"    "cloud_9am"       "cloud_3pm"       "temp_9am"   ...
## [21] "temp_3pm"        "rain_today"      "risk_mm"         "rain_tomorrow"

# Note the target variable.

target <- "rain_tomorrow"

# Place the target variable at the beginning of the vars.

vars <- c(target, vars) %>% unique() %>% rev() %T>% print()
##  [1] "risk_mm"         "rain_today"      "temp_3pm"        "temp_9am"   ...
##  [5] "cloud_3pm"       "cloud_9am"       "pressure_3pm"    "pressure_9am...
##  [9] "humidity_3pm"    "humidity_9am"    "wind_speed_3pm"  "wind_speed_9...
## [13] "wind_dir_3pm"    "wind_dir_9am"    "wind_gust_speed" "wind_gust_di...
## [17] "sunshine"        "evaporation"     "rainfall"        "max_temp"   ...
## [21] "min_temp"        "location"        "date"            "rain_tomorrow"


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.