I hereby claim:
- I am hrbrmstr on github.
- I am hrbrmstr (https://keybase.io/hrbrmstr) on keybase.
- I have a public key whose fingerprint is 8BEC EF50 9D70 C613 A59C 5AD7 CBB9 4084 59AD 8A98
To claim this, I am signing this object:
--- | |
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) |
I hereby claim:
To claim this, I am signing this object:
#include <Rcpp.h> | |
#include <boost/asio.hpp> | |
using namespace Rcpp; | |
Function message("message"); // lets us use R's message() function | |
//[[Rcpp::export]] | |
std::vector< std::string > gethostbyname(std::string hostname) { | |
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()) %>% |
library(XML) | |
library(httr) | |
library(stringr) | |
pantone_cotd <- function(cotd_url = "https://www.pantone.com/pages/colorstrology/colorstrology.aspx") { | |
# have to fake a real user agent to get the color | |
agent <- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2" | |
try(pantone <- GET(cotd_url, user_agent(agent))) |
library(XML) | |
library(httr) | |
library(rvest) | |
library(magrittr) | |
# setup connection & grab HTML the "old" way w/httr | |
freak_html <- htmlParse(content(GET("http://torrentfreak.com/top-10-most-pirated-movies-of-the-week-130304/"), as="text")) | |
# do the same the rvest way, using "html_session" since we may need connection info in some scripts | |
freak <- html_session("http://torrentfreak.com/top-10-most-pirated-movies-of-the-week-130304/") |
library(ggplot2) | |
library(ggmap) | |
vectorDestination <- function(lonlatpoint, travelvector) { | |
Rearth <- 6372795 | |
Dd <- travelvector$magnitude / Rearth | |
Cc <- travelvector$direction | |
library(rgeos) | |
library(rgdal) # needs gdal > 1.11.0 | |
library(ggplot2) | |
# map theme | |
devtools::source_gist("https://gist.github.com/hrbrmstr/33baa3a79c5cfef0f6df") | |
map = readOGR("readme-swiss.json", "cantons") | |
map_df <- fortify(map) |
theme_map <- function(base_size=9, base_family="") { | |
require(grid) | |
theme_bw(base_size=base_size, base_family=base_family) %+replace% | |
theme( | |
axis.line=element_blank(), | |
axis.text=element_blank(), | |
axis.ticks=element_blank(), | |
axis.title=element_blank(), | |
panel.background=element_blank(), | |
panel.border=element_blank(), |
library(rgeos) | |
library(rgdal) # needs gdal > 1.11.0 | |
library(ggplot2) | |
# map theme | |
devtools::source_gist("https://gist.github.com/hrbrmstr/33baa3a79c5cfef0f6df") | |
# grab each of the layers | |
limites = readOGR("division.json", "limites") |