Skip to content

Instantly share code, notes, and snippets.

View RickPack's full-sized avatar

Rick Pack RickPack

View GitHub Profile
@RickPack
RickPack / student_file_cleaner.r
Last active December 9, 2022 16:09
aid with cleaning export data and reconciling with other data. Discussed at https://wordpress.com/post/rickpackblog.wordpress.com/1851
# Point to location containing https://github.com/RickPack/meetupxlanimate/blob/master/R/rExcelhelper.R
Rhelper_folder <- "C:/Documents/R/Helper/"
require(pacman)
## installs packages it not found, but need pacman R package!
pacman::p_load(dplyr, openxlsx, readr, RecordLinkage, stringr)
source(paste0(Rhelper_folder, "rExcelhelper.R"))
## Location of data?
indir <- "C:/Documents/student/Mentoring/"
@RickPack
RickPack / biscale_census_Miami_Rent_Income.R_SI_abbrev.R
Last active July 18, 2022 17:28
Illustrates use of new si_levels argument for biscale R package - rounds and applies SI prefix to labels for bivariate choropleth legend
## CODE DISCUSSED in blog post: https://rickpackblog.wordpress.com/2022/07/18/bivariate-choropleths-with-biscale-package-new-si-prefix-in-legend/
## Outputs into save_folder a bivariate choropleth .PNG depcicting a county's
## median income vs. median rent using Jenks Natural Breaks Classification
state_var <- "FL"
county_var <- "Miami-Dade County"
save_folder <- "C:/Users/rick2/Documents/Rick/blog/biscale/"
#### Census API key
## Only need this line because API key stored in .Renviron
## If not stored, get Census API key at http://api.census.gov/data/key_signup.html then run
---
title: "Stack Overflow Consecutive PNG"
author: "Rick Pack"
date: "11/20/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@RickPack
RickPack / UltimateRunner_2019_Seed1.csv
Created June 20, 2019 16:20
Ultimate Runner 2019 - first seeding list - columnar format
Name Age Sex Mile_Seed
John S Tatter 19 M 0:04:15
Dale Johnson 23 M 0:04:25
Chase Wheeler 25 M 0:04:30
William Hamilton 17 M 0:04:37
Eleazar Garcia 28 M 0:04:40
Wil Zahorodny 29 M 0:04:40
Tom DePalma 22 M 0:04:45
Gage Hicks 29 M 0:05:00
Sam Ward 30 M 0:05:00
@RickPack
RickPack / SurveyMonkey_excel_email_cleaner.R
Created June 5, 2019 10:19
Use SurveyMonkey responses to remove unsubscribes and bounced emails from an Excel file with an Email_Address column
####################################################
## Reads email addresses copied and pasted from ##
## Surveymonkey screens into .txt files and then ##
## removes them from the original list. The ##
## final Excel workbook has the cleaned emails, ##
## a copy of the previously created second sheet ##
## (invalid emails, produced by ##
## excel_email_cleaner_new.R, found at: ##
## https://gist.github.com/RickPack/907a200cd40c786e19d045b379527f6d) ##
## and then worksheets with (i) bounced email ##
@RickPack
RickPack / Meetup_RSVP_Yes_latest.R
Last active March 4, 2019 02:05
Research Triangle Analysts Analytics>Forward Meetup RSVP tracking with R-Ladies Meetupr package.
library(httr)
library(tidyverse)
library(jsonlite)
library(meetupr)
library(lubridate)
library(magick)
library(directlabels)
###################################
## If need to use local CSV file ##
@RickPack
RickPack / Meetup_RSVP_Yes_20190223.R
Last active February 24, 2019 01:31
Analytics>Forward Meetup RSVP tracking- R Ladies Meetupr and applying Chuck Jaeger's suggestions
library(httr)
library(tidyverse)
library(jsonlite)
library(meetupr)
library(lubridate)
library(magick)
AMPM <- "PM"
todaydt <- str_replace_all(as.character(Sys.Date()), "-","_")
@RickPack
RickPack / Meetup_RSVP_Yes_20190221.R
Last active February 22, 2019 13:54
Analytics>Forward Meetup registrations using R-ladies meetupr package
library(httr)
library(tidyverse)
library(jsonlite)
library(meetupr)
library(lubridate)
library(magick)
# Installed from Rick Pack's fork of dmpe's
# February, 2019 Github update that uses
# Bitly API 4.0.0
# https://github.com/RickPack/urlshorteneR/
@RickPack
RickPack / Meetup_RSVP_Yes_20190217.R
Created February 17, 2019 13:12
Analytics>Forward Meetup RSVP training - R Ladies Meetupr and applying Chuck Jaeger's suggestions
library(httr)
library(tidyverse)
library(jsonlite)
library(meetupr)
library(lubridate)
# Get your Meetup key by going to
# https://secure.meetup.com/meetup_api/key/
MEETUP_KEY = "NOT_SHOWN"
@RickPack
RickPack / group_split_example.R
Last active February 17, 2019 11:58
dplyr group_split() and purrr map() function example - modified from Hadley Wickham's "Welcome to the Tidyverse" example, which used his customized gapminder data frame
# Modification of Hadley's "Welcome to the Tidyverse"
# demo of new dplyr group_split()
library(gapminder)
library(dplyr)
library(purrr)
library(ggplot2)
gap_plot <- function(data) { data %>%
arrange(desc(pop)) %>%
ggplot(aes(gdpPercap, lifeExp)) +
geom_point(aes(fill = continent, size = pop), shape = 21) +