Skip to content

Instantly share code, notes, and snippets.

Sharon Machlis smach

Block or report user

Report or block smach

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smach
smach / ImportZipCodes.R
Created Jun 20, 2019
See how readr imports Zip Codes compared with base R
View ImportZipCodes.R
price_median1 <- readr::read_csv("https://raw.githubusercontent.com/smach/BU-dataviz-workshop-2019/master/data/zillow_data_median_sf_price.csv")
str(price_median1)
price_median2 <- read.csv("https://raw.githubusercontent.com/smach/BU-dataviz-workshop-2019/master/data/zillow_data_median_sf_price.csv")
str(price_median2)
View app.R
if(!require(pacman)){
install.packages("pacman")
}
p_load(ggplot2, dplyr, janitor)
district <-c("A","B","C","A","B", "C")
money <-c(500,324,245,654,234, 232)
year <- c("2001", "2001", "2001", "2002", "2002", "2002")
df <- data.frame(district, money, year, stringsAsFactors = FALSE)
total_by_year <- df %>%
group_by(year) %>%
View import_fixedwidth_file.R
# Survey data file downloaded manually from the CDC https://www.cdc.gov/brfss/annual_data/annual_2017.html
surveydatafile <- "LLCP2017.ASC"
# I used datapasta package's df_paste() function to create the data frame below,
# after copying the metadata table into my clipboard. Metadata is here:
# https://www.cdc.gov/brfss/annual_data/2017/llcp_varlayout_17_onecolumn.html
column_meta_data <- data.frame(stringsAsFactors=FALSE,
Starting.Column = c(1L, 17L, 19L, 19L, 21L, 23L, 32L, 36L, 36L, 63L, 64L,
65L, 66L, 67L, 68L, 69L, 71L, 73L, 75L, 76L, 77L, 78L,
View pelias_test.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smach
smach / GitHub-Forking.md
Created Dec 11, 2017 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow
View GitHub-Forking.md

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@smach
smach / google_calendar_demo.R
Last active Oct 2, 2017 — forked from MarkEdmondson1234/google_calendar_demo.R
A demo of calling Google Calendar API
View google_calendar_demo.R
library(googleAuthR)
## set scopes for calendar
options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/calendar.readonly",
googleAuthR.client_id = "XXXX", ## add your Google project client Id - find it at https://console.developers.google.com/apis/credentials then click on the appropriate OAuth 2.0 client ID
googleAuthR.client_secret = "XXXX") ## add your Google project client secret - at same place as above
## make sure calendar API is activated for your Google Project at below URL:
# https://console.cloud.google.com/apis/api/calendar-json.googleapis.com/overview
View BosChiNYCsnowfalls.csv
Winter Boston Chicago NYC
1940-1941 47.8 52.5 39
1941-1942 23.9 29.8 11.3
1942-1943 45.7 45.2 29.5
1943-1944 27.7 24 23.8
1944-1945 59.2 34.9 27.1
1945-1946 50.8 23.9 31.4
1946-1947 19.4 34.1 30.6
1947-1948 89.2 38.1 63.2
1948-1949 37.1 14.3 46.6
View keybase.md

Keybase proof

I hereby claim:

  • I am smach on github.
  • I am sharon000 (https://keybase.io/sharon000) on keybase.
  • I have a public key whose fingerprint is C87F C261 72AE 1D42 1CCD 1F23 2C3F B45F 022F 6E5A

To claim this, I am signing this object:

View wdi_leaflet.R
# This function and helper functions create a Leaflet interactive map in R from a World Bank indicator. This code was created by Kyle E. Walker, director of the Center for Urban Studies at Texas Christian University and (very) slightly modified by Sharon Machlis. See Walker's kwgeo package at https://github.com/walkerke/kwgeo/ for more info. Any errors are most certainly Sharon's.
if (!require("WDI")) install.packages("WDI")
if (!require("rgdal")) install.packages("rgdal")
if (!require("sp")) install.packages("sp")
if (!require("leaflet")) install.packages("leaflet")
if (!require("httr")) install.packages("httr")
if (!require("maptools")) install.packages("maptools")
View MAEarlyVoting16_analysis.Rmd
---
title: ''
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
mydata <- read.csv("https://gist.githubusercontent.com/smach/9cc166277488d2499e208d2076ff26c3/raw/e2f596ce6a134657e4daa73550510f6fb949890b/MAEarlyVotingData.csv", stringsAsFactors = FALSE)
mydata <- subset(mydata, RegisteredVoters >= 30000)
You can’t perform that action at this time.