Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The html_vignette output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The html_vignette format:

Vignette Info

library(data.table)
library(parcels)
library(outlines)
library(geocodes.bad)
library(pkg.data.paths)
# Define paths
pkg.data.root <- '~/Dropbox/pkg.data' # devtools::install_github('erikbjohn/pkg.data.paths')

# Load package address data

# Load package shape data
parcels.shapes <- parcels::shapes(paste0(pkg.data.path, 'parcels'))
outlines.shapes <- outlines::shapes(paste0(pkg.data.path, 'outlines'))
l.shapes <- list(parcels=parcels.shapes, points=points.shapes,
                  outlines=outlines.shapes, geocodes.bad=geocodes.bad.shapes)

# Load mmed data
sDateStamp <- '20101215'
source <- paste0('mmed.', sDateStamp)

# Import Data and clean
rawData <- fread(paste0('~/Dropbox/Research/Marijuana/RawData/Colorado Marijuana Stores/MMED/Raw/', sDateStamp,'.csv'), colClasses = 'character')
rawData$V2 <- NULL
setnames(rawData, names(rawData), c('name', 'lic.type', 'street', 'city', 'zip', 'county'))
rawData <- rawData[name!='Applicant Name' & !(lic.type=='')]
rawData <- unique(rawData)

# Assign Date
rawData <- rawData[, date.snapshot := as.Date(sDateStamp, format='%Y%m%d')]

# Clean license.type
rawData <- rawData[, lic.type := methods.string::clean.lic.type(lic.type)]

## Subset
rawData$type <- 'Medical'
match.threshold=0.6

study.cities <- 'Denver'
parcels.address <- parcels::address(dt.pkg.data[pkg.name=='parcels']$pkg.root[1])
study.zips <- unique(parcels.address[city %in% study.cities]$zip)
study.zips <- study.zips[study.zips!='']
study.states <- unique(parcels.address[city %in% study.cities]$state)
l.study.extent <- list(zips = study.zips, cities=study.cities, states = study.states)

## Create study Geography
rawData <- funImport(rawData, source, match.threshold=0.6, l.study.extent=NULL, pkg.data.root, l.study.extent)


erikbjohn/assign.locations documentation built on May 30, 2019, 8:03 a.m.