Benjamin Soltoff
January 14, 2016
# load packages
require(dplyr)
library(tidyverse) | |
library(sf) | |
# import shapefile and extract Massachusetts | |
usa <- st_read("cb_2013_us_state_20m/cb_2013_us_state_20m.shp") | |
mass <- usa %>% | |
filter(NAME == "Massachusetts") | |
# identify city locations | |
cities <- tribble( |
library(tidyverse) | |
library(tidytext) | |
library(tm) | |
set.seed(123) # random number generator seed | |
# get USCongress data | |
data(USCongress, package = "RTextTools") | |
congress <- as_tibble(USCongress) %>% | |
mutate(text = as.character(text)) |
###### code to run on RStudio cloud project | |
pkg_cran <- c("reprex", "tidyverse", "sf", "tidycensus", "viridis", "knitr", | |
"gapminder", "forcats", "broom", "wordcloud", "tidytext", "rebird", | |
"geonames", "modelr", "rsample", "magrittr", "ISLR", "titanic", | |
"microbenchmark", "partykit", "caret", "nycflights13", "ggplot2", | |
"tibble", "harrypotter", "ggwordcloud", "here", "arrow", "readxl", | |
"haven", "ggmap", "rnaturalearth", "rtweet", "leaflet", "stringr", | |
"widgetframe", "RColorBrewer", "patchwork", "ymlthis", "RSocrata", | |
"dplyr", "shiny", "httr", "repurrrsive", "purrr", "acs", "downloader", | |
"statebins", "rsparkling", "sparklyr", "h2o", "dbplyr", "bigrquery", |
## cm004_tidy_tutorial.R | |
## Benjamin Soltoff | |
## Practice tidying data | |
# load libraries | |
library(dplyr) | |
library(tidyr) | |
# racial data | |
race <- read.table(header = TRUE, check.names = FALSE, text = " |
# cm003_scorecard_practice.R | |
# Benjamin Soltoff | |
# Practice transforming and exploring data using the Department | |
# of Education's College Scorecard data set for 2013 | |
# load necessary libraries | |
library(dplyr) | |
library(ggplot2) | |
# get dataset from rcfss library |
node | start | island1 | island2 | island3 | island4 | island5 | island6 | end | |
---|---|---|---|---|---|---|---|---|---|
start | 0 | 1 | 1 | 1 | |||||
island1 | 1 | 0 | 1 | 1 | |||||
island2 | 1 | 1 | 0 | 1 | 1 | ||||
island3 | 1 | 1 | 0 | 1 | |||||
island4 | 1 | 0 | 1 | 1 | |||||
island5 | 1 | 1 | 0 | 1 | 1 | ||||
island6 | 1 | 1 | 0 | 1 | |||||
end | 1 | 1 | 1 | 0 |