Skip to content

Instantly share code, notes, and snippets.

View hrbrmstr's full-sized avatar
💤
#tired

boB Rudis hrbrmstr

💤
#tired
View GitHub Profile
@hrbrmstr
hrbrmstr / amsmeteors.R
Last active January 3, 2016 02:18
Get the amsmeteors.org observations <table> into CSV format (R version)
library(XML)
library(plyr)
observations <- readHTMLTable("http://www.amsmeteors.org/observations/", which=1)
observations$Altitude <- gsub("[m,]", "", observations$Altitude)
observations$Altitude <- gsub("-", "0", observations$Altitude)
observations$Location = gsub("\\s", "", observations$Location)
observations$Location = gsub("°", "", observations$Location)
@hrbrmstr
hrbrmstr / server.R
Last active August 28, 2021 01:43
Shiny app code for SolvoMediocris : http://shiny.dds.ec/solvomediocris/
library(shiny)
library(mc2d)
library(ggplot2)
library(scales)
shinyServer(function(input,output){
values <- reactiveValues()
values$N <- 50000
@hrbrmstr
hrbrmstr / marx-geo.R
Last active January 3, 2016 18:09
for upcoming dds blog post
library(data.table)
library(bit64)
# data.table is a wicked fast data.frame compatible object
# and fread() is a wicked fast file reader that behaves
# like read.csv(). it's even faster and more efficient if
# we provide a row count (estimate) so we do that here
marx <- fread("marx-geo.csv", nrows=451582, sep=",", header=TRUE)
@hrbrmstr
hrbrmstr / global.R
Last active August 29, 2015 13:56
sochi 2014 in R using google docs scraper & line+dot plot facets. see it in action at http://shiny.dds.ec/sochi2014 or run it locally via "shiny::runGist(8949172)" which can be invoked directly from a command-prompt (on any operating system) thusly: "Rscript -e "shiny::runGist(8949172,launch.browser=TRUE)"
library(shiny)
library(ggplot2)
library(RCurl)
library(reshape2)
library(shiny)
library(ggplot2)
library(scales)
library(grid)
library(gridExtra)
shinyServer(function(input, output) {
output$countPlot <- renderPlot({
@hrbrmstr
hrbrmstr / quakes.R
Created April 1, 2014 19:37
March 2014 California Earthquakes via ggmap/ggplot
library(ggplot2)
library(ggmap)
library(plyr)
library(grid)
library(gridExtra)
# read in cleaned up data
dat <- read.table("quakes.dat", header=TRUE, stringsAsFactors=FALSE)
# map decimal magnitudes into an integer range
@hrbrmstr
hrbrmstr / build.sh
Last active August 29, 2015 14:00
For dds.ec blog post "Making Better DNS TXT Record Lookups With Rcpp" - (all code MIT license)
export PKG_LIBS=`Rscript --vanilla -e 'Rcpp:::LdFlags()'`
export PKG_CPPFLAGS=`Rscript --vanilla -e 'Rcpp:::CxxFlags()'`
R CMD SHLIB -lldns txt.cpp
@hrbrmstr
hrbrmstr / qualys.R
Last active October 11, 2017 20:15
get the Qualys SSL Labs rating for a domain+cert
library(RCurl)
library(XML)
library(plyr)
#' get the Qualys SSL Labs rating for a domain+cert
#'
#' @param site domain to test SSL configuration of
#' @param ip address of \code{site} (will resolve it and take\cr
#' first response if not specified, but that may not always work as you expect)
#' @param hide.results ["on"|"off"] should the results show up in the SSL Labs history (default "on")
---
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