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'
@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)
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
@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")
),
@tcash21
tcash21 / server.R
Created September 7, 2016 18:03
radarchart jittery issue
library(radarchart)
labs <- c(1:25)
scores <- list("Rich" = rnorm(25, 1, 10),
"Andy" = rnorm(25, 10, 5),
"Aimee" = rnorm(25, 20, 5))
library(stattleshipR)
library(dplyr)
library(ggplot2)
set_token("YOUR_TOKEN_GOES_HERE")
## pull all 'team_game_logs' from the Stattleship API
## set parameters here
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)