This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(stringr) | |
deaths<-read.csv("z_KoreanConflict.csv", header=TRUE, stringsAsFactors=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
library(stringr) | |
library(lubridate) | |
# First grab the data and filter out the bad data in INCIDENT_DATE (see https://gist.github.com/rer145/68b75131d7e2d89adc53b1f8d75ab294) | |
deaths<-read.csv("KoreanConflict.csv", header=TRUE, stringsAsFactors=FALSE) | |
regEx = "^\\d{8}$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(stringr) | |
deaths<-read.csv("z_KoreanConflict.csv", header=TRUE, stringsAsFactors=FALSE) | |
# We want to make sure all data in INCIDENT_DATE is correct | |
# A quick investigation shows the data in a YYYYMMDD format, but some fields are empty | |
# A simple regular expression can just check for 8 digits | |
regEx = "^\\d{8}$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Lahman) | |
library(dplyr) | |
library(ggplot2) | |
library(ggiraph) | |
# Get all teams from 1980 and the number of home runs hit | |
df<-Teams %>% | |
filter(yearID == 1980) %>% | |
select(name, HR) %>% | |
arrange(HR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(Lahman) | |
library(ggplot2) | |
# Get all the teams from 1980 and how many home runs they hit | |
df<-Teams %>% | |
filter(yearID==1980) %>% | |
select(name, HR) %>% | |
arrange(HR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidytext) | |
library(janeaustenr) | |
# Using dplyr and janeaustenr, get the contents of 'Sense & Sensibility' | |
sns<-austen_books() | |
sns<-sns%>% | |
filter(book=='Sense & Sensibility') | |
head(sns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidytext) | |
library(janeaustenr) | |
# Using dplyr and janeaustenr, get the contents of 'Sense & Sensibility' | |
sns<-austen_books() | |
sns<-sns%>% | |
filter(book=='Sense & Sensibility') | |
head(sns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gutenbergr) | |
library(stringr) | |
# search for the EXACT name of the novel title | |
gutenberg_works(title=='Dracula') | |
# search for the EXACT author's name (Last Name, First Name) | |
gutenberg_works(author=='Stoker, Bram') | |
# search for the word 'Frankenstein' in the title column |
NewerOlder