-
Notifications
You must be signed in to change notification settings - Fork 6
/
set-up.R
38 lines (34 loc) · 1.5 KB
/
set-up.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Project settings - libraries you'll need to load
# NB: devtools allows installation of the latest packages
if(!require(devtools)) install.packages("devtools")
if(!require(stplanr)) install_github("robinlovelace/stplanr")
pkgs <- c(
"ggmap",
"tmap",
"foreign", # loads external data
"rgdal", # for loading and saving geo* data
"dplyr", # for manipulating data rapidly
"rgeos", # GIS functionality
"raster", # GIS functions
"maptools", # GIS functions
"stplanr", # Sustainable transport planning with R
"geojsonio", # loads geojsons
"tidyr", # tidies up your data!
"readr", # reads your data fast
"knitr", # for knitting it all together
"geojsonio"
)
# Which packages do we require?
# lapply(pkgs, library, character.only = T)
reqs <- as.numeric(lapply(pkgs, require, character.only = TRUE))
# Install packages we require
if(sum(!reqs) > 0) install.packages(pkgs[!reqs])
# Load publicly available test data
# Option 1: clone the repository directly - if you have git installed
# system2("git", args=c("clone", "[email protected]:Robinlovelace/pct-data.git", "--depth=1"))
# Option 2: download and unzip the pct-data repository
# download.file("https://github.com/Robinlovelace/pct-data/archive/master.zip", destfile = "pct-data.zip", method = "wget")
# unzip("pct-data.zip", exdir = "pct-data")
# list.files(pattern = "pct") # check the data's been downloaded
# Option 3: download data manually from https://github.com/Robinlovelace/pct-data/archive/master.zip
cckey <- Sys.getenv('CS_API_KEY')