Skip to content

Instantly share code, notes, and snippets.

@Sandy4321
Sandy4321 / delly_imger
Created December 18, 2015 15:16 — forked from abresler/delly_imger
Fun Imager Example Delly-Curry Imager Example
## Dellie Meme
library(imager) ## install https://github.com/dahtah/imager/tree/master
library(magrittr)
library(dplyr)
lol_delly <-
'http://cavaliersnation.com/wp-content/uploads/2015/06/praUXJ9.jpg'
im <-
lol_delly %>%
@Sandy4321
Sandy4321 / nba_kohonen_viz
Created December 18, 2015 15:16 — forked from abresler/nba_kohonen_viz
Interactive NBA Kohonen Viz
nba_kohonen_viz <- function(season.end = 2015, team.totals = T, min_games = 5, scale_per_minute = T, xdim = 12, ydim = 12, clusters = 12, show.ids = T){
get_bref_player_season_stats <- function(season.end, stat_type = c("Advanced","Totals","Per Minute","Per Game"), team.totals = F , league = 'NBA'){
packages <-
c('rvest','magrittr','dplyr','stringr','tidyr')
lapply(packages, library, character.only = T)
bref_team_base <-
'http://www.basketball-reference.com/leagues/'
bref_base <-
'http://www.basketball-reference.com'
@Sandy4321
Sandy4321 / get_nba_player_game_logs
Created December 18, 2015 15:17 — forked from abresler/get_nba_player_game_logs
NBA Player Game Log Function
### Example get_nba_player_game_log_stats(player = "Zach Randolph", season = 2001:2014)
get_nba_player_game_log_stats <-
function(player, season , season.type = 'Regular Season') {
packages <-
c('dplyr', 'magrittr', 'jsonlite', 'stringr', 'tidyr', 'lubridate', 'readr')
lapply(packages, library, character.only = T)
players <-
"https://raw.githubusercontent.com/abresler/si_hackathon/master/data/nba/all_player_data.csv"%>%
read_csv()
@Sandy4321
Sandy4321 / netsdaily_polarity_plot
Created December 18, 2015 15:17 — forked from abresler/netsdaily_polarity_plot
Netsdaily Polarity Plot in R
### Parsing Netsdaily for a Polarity Plot -- working with JSON
packages <-
c('magrittr', 'dplyr', 'qdap', 'jsonlite', 'ggplot2')
lapply(packages, library, character.only = T)
url <-
'http://www.netsdaily.com/comments/load_comments/8261850'
data <-
url %>%
### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: [email protected]
### Twitter: @michaeljkoontz
###
#devtools::install_github("rstudio/leaflet", ref="feature/color-legend")
library(leaflet)
library(RColorBrewer)
set.seed(100)
pdf <- data.frame(Latitude = runif(100, -90,90), Longitude = runif(100, -180,180))
#make a property with colors
pdf$Study <- rep(1:10,10)
#need to create a pal using colorbin
library(DiagrammeR);library(magrittr)
" gantt
dateFormat YYYY-MM-DD
title Diagrammer and Gant Charts, JEAH
section Celebrate
Completed task :done, des1, 2014-01-06,2014-01-08
Isn't R the Best? :active, des2, 2014-01-09, 3d
Celebrate like Ryan Lochte : des3, after des2, 5d
Thank Kent and Rich for Being Heroes : des4, after des3, 5d
@Sandy4321
Sandy4321 / gist:bf77c6680a0f5c60e22f
Created December 18, 2015 15:36 — forked from abresler/gist:738be2df2284fed94401
Streamgraph NAREIT Growth
library(rvest); library(dplyr); library(tidyr);library(streamgraph); library(magrittr)
url <- #where does the data live
"https://www.reit.com/investing/industry-data-research/us-reit-industry-equity-market-cap"
reits_raw <- #scrape it
url %>%
html %>%
html_table(header = F) %>%
data.frame
# Get the latest version of 'DiagrammeR'
install_github("rich-iannone/DiagrammeR")
# Create a 'nodes' data frame
nodes <- sample(1:100, 100, replace = FALSE)
style <- rep("filled", 100)
fillcolor <- c(rep("turquoise", 20), rep("pink", 20),
rep("ochre", 20), rep("gray40", 20),
@Sandy4321
Sandy4321 / dogs.R
Created December 18, 2015 15:37 — forked from abresler/dogs.R
# Reading in 'dogs.csv'
# Created by Alex Bresler, available at:
# https://github.com/abresler/abresler.github.io/blob/master/blog/2015/february/exploring_agility_show/data/dogs.csv
dogs <- read.csv("dogs.csv", header = TRUE, stringsAsFactors = FALSE)
# Setting a numeric id
node_id <- 1:nrow(dogs)
# Getting unique values for the 'breed' column
unique_node_2 <- unique(dogs$breed)