3 Some introductory functions
This is an export of an R Markdown Notebook. When you access the raw notebook, you can execute code within the notebook on your computer and the results appear beneath the code.
If you have downloaded the code, you can try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
3.1 First, we’re going to load libraries
Normally you’d hide the code chunk below, but in this instance we’ll keep it there.
library(tidyverse) #loads ggplot2, stringr,
#Installing tidyverse includes (but won't load as part of it) readxl, jsonlite, lubridate, httr, rvest, xml2, googlesheets4,
library(readxl)
library(jsonlite)
library(lubridate)
library(httr)
#these are also useful (in part to demonstrate features)
library(psych)
library(doBy)
library(reshape2)
library(lattice)
library(scales)
library(tidytext)
#SimComp lets me create some random datasets with defined properties
library(SimComp)
#The ones below are specifically for this data
library(dslabs)
library(trackeR)
library(trackeRapp)
#library(maptools)
#library(revgeo)
#So I can embed webpages
#install.packages("webshot")
#webshot::install_phantomjs()
library(webshot)
library(htmlwidgets)
library(widgetframe)Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.