Skip to content

Instantly share code, notes, and snippets.

@Robinlovelace
Last active August 29, 2015 14:21
Show Gist options
  • Save Robinlovelace/468a8c9b8d5e80bd5315 to your computer and use it in GitHub Desktop.
Save Robinlovelace/468a8c9b8d5e80bd5315 to your computer and use it in GitHub Desktop.
Demo of R tutorial
x <- 1:99
y = x^2 / exp(x)
plot(x, y)
pkgs <- c("downloader", "readxl")
install.packages(pkgs)
lapply(pkgs, library, character.only = T)
dir.create("big-data")
download("http://tinyurl.com/r-for-bd-8",
"big-data/UKWCS.xls", mode = "wb")
wcs <- read_excel("big-data//UKWCS.xls")
edu <- wcs$highedu
edu_f <- as.factor(edu)
levels(edu_f)
plot(edu_f)
levels(edu_f) <- c("Alev", "Univ", "None", "Olev")
edu_f <- factor(edu_f,
levels(edu_f)[c(2, 1, 4, 3)])
plot(edu_f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment