Skip to content

Instantly share code, notes, and snippets.

View mjhendrickson's full-sized avatar

Matthew Hendrickson mjhendrickson

View GitHub Profile
@mitchelloharawild
mitchelloharawild / twitter_list_members.R
Last active March 6, 2019 07:06
Code for obtaining a list of members from twitter
library(httr)
library(purrr)
token <- rtweet:::check_token(NULL)
dsw <- GET(url = "https://api.twitter.com/1.1/lists/members.json?slug=women-in-data-science&owner_screen_name=becomingdatasci&cursor=-1&count=5000&skip_status=1", token)
map_chr(content(dsw)$users, "screen_name") %>% sort %>% cat(sep = "\n")
#> ___dhara___
#> __Helma
#> _ajbc
#> _beenkim
#> _ehinosa
@mschnetzer
mschnetzer / selfassessment.r
Last active December 31, 2019 10:33
Current and estimated position in the net wealth distribution (https://twitter.com/matschnetzer/status/1090954828631732224)
library(tidyverse)
library(survey)
library(msthemes)
library(gganimate)
# Load HFCS and Non-core data
load("hfcs2014AT.rda")
load("Noncore AT/non-core-at.rda")
# Calculate estimated decile with mean from multiple imputation data
@PaulC91
PaulC91 / purrr_ppt_maker.R
Last active March 2, 2019 17:17
R code to generate multiple powerpoint decks with native ppt charts from a single dataset using officer and purrr
library(tidyverse)
library(officer)
library(mschart)
# function to make ppt deck for each class in mpg data
new_deck <- function (i) {
data <- mpg %>%
filter(class == i)
ppt_chart <- ms_scatterchart(data, x = "displ", y = "hwy", group = "cyl") %>%
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active April 24, 2024 18:22
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs: