Skip to content

Instantly share code, notes, and snippets.

View rudeboybert's full-sized avatar
💭
Keep it real

Albert Y. Kim rudeboybert

💭
Keep it real
View GitHub Profile
@rudeboybert
rudeboybert / sds-csc-293-regression.R
Last active April 3, 2019 16:45
SDS/CSC 293 Regression Code
#------------------------------------------------------------------------------
# Lec08: 2019/02/25
#------------------------------------------------------------------------------
library(tidyverse)
library(broom)
library(stringr)
#------------------------------------------------------------------------------
# Data for today
@rudeboybert
rudeboybert / sds-csc-293.R
Last active February 13, 2019 14:38
SDS/CSC 293 Code
#------------------------------------------------------------------------------
# Lec02: 2019/01/30
#------------------------------------------------------------------------------
library(tidyverse)
library(moderndive)
# 1. Load in training and test data
train <- read_csv("https://rudeboybert.github.io/SDS293/static/train.csv")
test <- read_csv("https://rudeboybert.github.io/SDS293/static/test.csv")
@rudeboybert
rudeboybert / keybase.md
Created December 7, 2018 12:06
keybase.md

Keybase proof

I hereby claim:

  • I am rudeboybert on github.
  • I am rudeboybert (https://keybase.io/rudeboybert) on keybase.
  • I have a public key whose fingerprint is 9BC5 364D 4EF2 6E73 F2BF 09A8 00F8 04CC B263 7D03

To claim this, I am signing this object:

@rudeboybert
rudeboybert / infer_permutation_test.R
Last active December 7, 2018 18:09
Permutation hypothesis test
library(tidyverse)
library(infer)
africa_results <-
"https://rudeboybert.github.io/SDS220/static/PS/africa_results.csv" %>%
read_csv() %>%
select(priming_number, how_many_countries)
View(africa_results)
# What actually happened! Observed difference
@rudeboybert
rudeboybert / infer.R
Last active November 30, 2018 18:04
infer package
#-------------------------------------------------------------------------------
# Setup
#-------------------------------------------------------------------------------
library(tidyverse)
# Population of heights
population_heights <- read_csv("https://goo.gl/3gsSwx")
View(population_heights)
# The population mean mu. What we will pretend we don't know. Equals 164.3cm.
@rudeboybert
rudeboybert / maps_using_sf.R
Last active November 14, 2018 16:53
Maps using sf
# Lec 27: Friday 2018/11/9
library(tidyverse)
library(USAboundaries)
library(leaflet)
library(maps)
library(fivethirtyeight)
library(sf)
# Forget Lec26! sf package for maps is better!
USA_sf <- maps::map("state", plot = FALSE, fill = TRUE) %>%
@rudeboybert
rudeboybert / clinton_vs_trump.R
Last active November 8, 2018 17:20
Clinton vs Trump 2016 Campaign Stops
library(tidyverse)
library(fivethirtyeight)
library(maps)
# View Clinton vs Trump 2016 campaign stops data. Based on
# https://fivethirtyeight.com/features/the-last-10-weeks-of-2016-campaign-stops-in-one-handy-gif/
View(pres_2016_trail)
# Load US state data. See ?map_data() for other options
us_state_map <- map_data("state") %>%
@rudeboybert
rudeboybert / modeling_with_data_tidyverse.R
Last active April 16, 2024 18:16
R source code for "Modeling with Data in the Tidyverse" DataCamp course
# R source code for all slides/videos in Albert Y. Kim's "Modeling with Data in
# the Tidyverse" DataCamp course:
# https://www.datacamp.com/courses/modeling-with-data-in-the-tidyverse
# This code is available at http://bit.ly/modeling_tidyverse
# Load all necessary packages -----
library(ggplot2)
library(dplyr)
library(moderndive)
@rudeboybert
rudeboybert / seattle_house_prices_interactive_plot.R
Last active July 19, 2018 20:40
plotly R code for interactive 3D scatterplot & regression plane of Seattle house prices
library(tidyverse)
library(plotly)
library(moderndive)
# Preprocess data ---------------------------------------------------------
set.seed(76)
data(house_prices)
# Re-scale price and size (square footage) by log10 and take a subsample of points
@rudeboybert
rudeboybert / gapminder.R
Last active February 8, 2018 00:31
One Simple, One Fancy, and One Interactive gapminder Bubbleplot
library(ggplot2)
library(dplyr)
library(gapminder)
# Only for 2007 data
gapminder2007 <- gapminder %>%
filter(year == 2007)
# Simple plot -------------------------------------------------------------