View graphics.js
var $graphic = $('#graphic'); | |
var fmt_year_abbr = d3.time.format('%y'); | |
var fmt_year_full = d3.time.format('%Y'); | |
var graphic_data; | |
var graphic_data_url = 'data.csv'; | |
var graphic_default_width = 600; | |
var is_mobile; | |
var mobile_threshold = 540; | |
var pymChild = null; |
View plot.cox.zph
plot.cox.zph <- function (x, resid = TRUE, se = TRUE, df = 4, nsmo = 40, var, smoothcol="black", confcol="black", ...) { | |
xx <- x$x | |
yy <- x$y | |
d <- nrow(yy) | |
df <- max(df) | |
nvar <- ncol(yy) | |
pred.x <- seq(from = min(xx), to = max(xx), length = nsmo) | |
temp <- c(pred.x, xx) | |
lmat <- splines::ns(temp, df = df, intercept = TRUE) | |
pmat <- lmat[1:nsmo, ] |
View mass_shootings.Rmd
--- | |
title: "Mass Shootings Are Horrifying Enough Without Fudging The Numbers" | |
author: "Bob Rudis (@hrbrmstr)" | |
date: "August 28, 2015" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE, fig.retina=2) | |
``` |
View global.R
library(shiny) | |
library(ggplot2) | |
library(RCurl) | |
library(reshape2) |
View sltl-example.R
library(sltl) | |
out <- sltl(as.timeSeries(co2), | |
c.window=101, | |
c.degree=1, | |
type="monthly") | |
summary(out) | |
plot.sltl(out) |
View server.R
library(shiny) | |
library(ggplot2) | |
library(scales) | |
library(grid) | |
library(gridExtra) | |
shinyServer(function(input, output) { | |
output$countPlot <- renderPlot({ | |
View build.sh
export PKG_LIBS=`Rscript --vanilla -e 'Rcpp:::LdFlags()'` | |
export PKG_CPPFLAGS=`Rscript --vanilla -e 'Rcpp:::CxxFlags()'` | |
R CMD SHLIB -lldns txt.cpp |
View vectorize-part-1.Rmd
--- | |
title: "Vectorize() Vectorization Example" | |
author: "Bob Rudis (@hrbrmstr)" | |
date: "May 16, 2014" | |
output: md_document | |
--- | |
```{r echo=FALSE, message=FALSE, error=FALSE, warning=FALSE} | |
library(Rcpp) | |
# We need this to ensure knitr+Rcpp can link to the boost library |
View vectorize-part-2.Rmd
--- | |
title: "Rcpp Vectorization Example" | |
author: "Bob Rudis (@hrbrmstr)" | |
date: "May 17, 2014" | |
output: md_document | |
--- | |
```{r echo=FALSE, message=FALSE, error=FALSE, warning=FALSE} | |
library(Rcpp) | |
library(bitops) | |
library(scales) |
View statebins-vcdb-pop.R
library(data.table) | |
library(verisr) | |
library(dplyr) | |
library(statebins) | |
vcdb <- json2veris("/Users/bob/Desktop/r/VCDB-d3/VCDB/data/json/") | |
tbl_dt(vcdb) %>% | |
filter(victim.state %in% state.abb) %>% | |
group_by(victim.state) %>% | |
summarize(count=n()) %>% |
OlderNewer