- Practical Predictive Analytics
- Ralph Winters
- 117字
- 2025-04-04 19:02:43
Housekeeping and loading of necessary packages
First, clear out the workspace (after saving any R objects you will need later):
rm(list = ls())
Then, install the required packages:
install.packages("dplyr")
install.packages("wakefield")
install.packages("sqldf")
install.packages("RSQLite")
The convention in this book will be to specify a simple install.packages("packagename") instruction to install the necessary packages, followed by a library("packagename") to load them into memory. Once the required packages are installed, you can either comment them out, or replace the line with conditional installation code:
try(require(dplyr) || install.packages("dplyr"))
But this syntax may not work on all R installations and GUIs, so we will keep it simple, and explicitly specify install.package().
Now we will load the required packages into memory:
library(dplyr)
library(wakefield)
library(sqldf)
library(RSQLite)