This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 | |
### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |