Skip to content

Instantly share code, notes, and snippets.

View imdb-all.R
# import packages
library(tidyverse)
library(rvest)
library(lubridate)
library(scales)
# define list of shows
shows = tibble(
name = c('The Office', 'Parks & Recreation', 'Modern Family', 'Community', 'New Girl', 'The Good Place'),
imdb_id = c('tt0386676', 'tt1266020', 'tt1442437', 'tt1439629', 'tt1826940', 'tt4955642'),
View mouse-backup.R
# import
library(rJava)
library(rMouse)
Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_241') # for 64-bit version
# loop
condition = FALSE
while(condition == FALSE) {
Sys.sleep(30)
View top-r-packages.R
library(rvest)
library(stringr)
# get list of gists
all_links = c()
for (i in 1:25) {
url = paste('https://gist.github.com/erikgregorywebb?page=', i, sep ='')
print(url)
Sys.sleep(1)
page = read_html(url)
View hbcus-scrape.R
library(tidyverse)
library(rvest)
library(tools)
library(fuzzyjoin)
# extract list of programs by state (source: mastersindatascience.org)
url = 'https://www.mastersindatascience.org/schools/'
page = read_html(url)
states = page %>% html_nodes('.row') %>% html_nodes('a') %>% html_attr('href')
View come-follow-me-scraper.R
# simple scraper to compile schedule for 2021 Come Follow Me
# Source: https://www.churchofjesuschrist.org/study/manual/come-follow-me-for-individuals-and-families-doctrine-and-covenants-2021?lang=eng
library(tidyverse)
library(rvest)
# define list of weeks digits
weeks = c(c('01', '02', '03', '04', '05', '06', '07', '08', '09'), as.character(10:56))
# loop over 52 weeks, scraping title content
View realtor-market-hotness.R
library(tidyverse)
library(zipcode)
library(lubridate)
# import "market hotness" data from realtor.com
url = 'https://econdata.s3-us-west-2.amazonaws.com/Reports/Hotness/RDC_Inventory_Hotness_Metrics_Zip_History.csv'
download.file(url, 'realtor-hotness-zip.csv')
raw = read_csv('realtor-hotness-zip.csv')
glimpse(raw)
View clinicaltrials-xml.R
library(tidyverse)
library(rvest)
library(xml2)
library(XML)
# extract list of xml files
setwd("~/Fiverr/clinicaltrials/NCT0247xxxx")
xml_files = list.files()
# loop over files, extracting content
View realtor-dallas.R
library(tidyverse)
library(zipcode)
library(lubridate)
# import dallas zipcodes
url = 'https://raw.githubusercontent.com/erikgregorywebb/datasets/master/dallas-metro-zipcodes.csv'
download.file(url, 'dallas-metro-zipcodes.csv')
dallas_zipcodes = read_csv('dallas-metro-zipcodes.csv')
# import realtor.com
View apple-jobs-scrape.R
library(tidyverse)
library(rvest)
# compile list of job listings urls
listing_urls = c()
for (i in 1:20) {
base_url = paste('https://jobs.apple.com/en-us/search?location=united-states-USA&page=', i , sep = '')
print(base_url)
page = read_html(base_url)
View bible-database.R
# import libraries
library(scriptuRs)
library(tidyverse)
# get scripture
bible = scriptuRs::kjv_bible()
# roll up by chapter
bible_chapters = bible %>%
mutate(verse = paste(verse_number, '', text, '\n\n')) %>%