Skip to content

Instantly share code, notes, and snippets.

@tcash21
tcash21 / app.R
Created February 25, 2020 03:05
plotly_click + ggplot bug?
library(plotly)
library(shiny)
mtcars$key <- row.names(mtcars)
mtcars$col <- "black"
mtcars$name <- row.names(mtcars)
ui <- fluidPage(
plotlyOutput("plot")
)

Keybase proof

I hereby claim:

  • I am tcash21 on github.
  • I am tcash21 (https://keybase.io/tcash21) on keybase.
  • I have a public key ASCkG9_SuHwKSbUbA-4XN6CucoDLXcR3yf-AdseMHSh6FQo

To claim this, I am signing this object:

library(rvest)
library(jsonlite)
#/lol/summoner/v3/summoners/{summonerId}
#/lol/match/v3/matchlists/by-account/{accountId}
key <- 'Your-API-KEY'
summoner_id <- '88770698'
base_url <- 'https://na1.api.riotgames.com'
library(XML)
library(RCurl)
library(ggplot2)
results <- c()
## Loop through the 30 pages of player data
for(i in 1:30){
theURL <- paste("http://www.nhl.com/ice/playerstats.htm?fetchKey=20122ALLSASAll&viewName=summary&sort=points&pg=", i, sep="")
webpage <- getURL(theURL)
@tcash21
tcash21 / full_openvis_analysis.R
Created May 13, 2017 15:50
OpenVisConf Transcript Analysis
library(rvest)
library(tidytext)
library(stringr)
library(purrr)
library(ggplot2)
library(tidyr)
options(stringsAsFactors = FALSE)
## use phantomjs to download the webpage content (javascript-generated)
d3.csv("../data/imdb.csv", function(data) {
dataset = data
});
offset = 2
circles = d3.select("body")
.append("svg")
.attr("width", width)
install.packages("devtools")
devtools::install_github("stattleship/stattleship-r")
install.packages('dplyr')
install.packages('ggplot2')
## Load the stattleshipR package
library(stattleshipR)
library(dplyr)
library(ggplot2)
library(benford.analysis)
## read in data
counties <- read.csv(file="https://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csvhttps://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csv")
## Run Benford tests
hrc <- benford(subset(counties, name == 'H. Clinton')$votes)
trump <- benford(subset(counties, name == 'D. Trump')$votes)
## plot results
library(ROAuth)
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
consumerKey <- 'XXXXX'
consumerSecret <- 'XXXXXX'
my_oauth <- OAuthFactory$new(consumerKey = consumerKey,
consumerSecret = consumerSecret,
requestURL = requestURL,
@tcash21
tcash21 / spinner.gif
Created October 15, 2016 16:26
Shiny loading spinner
conditionalPanel(id='loader',
condition="($('html').hasClass('shiny-busy'))",
img(src="spinner.gif")
),