http://twitter.com/HisRauhlDreamer/status/394639612741550080 http://twitter.com/ImaStreetHustla/status/391681143415644160 http://twitter.com/boricua_babayyy/status/409376425939312640 http://twitter.com/samanthamonzote/status/423229161499799553 http://twitter.com/DJ_Leezy/status/440333064355319809 http://twitter.com/MAL_THE_OPP/status/444587945493037056 http://twitter.com/21keezy_g/status/453868954318938112 http://twitter.com/shekinah005/status/453979525320167424 http://twitter.com/WelWelMico/status/457010700020236288
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
next_letter <- local({ | |
i <- 0 | |
function() { | |
i <<- i + 1 | |
paste0("x_", c(letters, LETTERS))[i] | |
} | |
}) | |
f <- function() { | |
new_arg <- alist(x = ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("Quandl") | |
library("ggplot2") | |
library("reshape2") | |
hist_rev <- Quandl("TPC/HIST_RECEIPT", | |
start_date = "1945-12-31", | |
end_date = "2013-12-31") | |
# melt into tidy (http://vita.had.co.nz/papers/tidy-data.html) form | |
hist_revm <- melt(hist_rev, id = "Fiscal Year") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script uses httr to download data from Google's API | |
# Notice ther is a limit of 2,500 calls per day | |
library(httr) | |
base_url <- "http://maps.google.com/maps/api/geocode/json" | |
geoCode <- function(address,verbose=FALSE) { | |
r <- GET(base_url, query = list(address = address, sensor = "false")) | |
stop_for_status(r) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_installed <- function(pkg, version = NULL) { | |
system.file(package = pkg) != "" && version_ok(pkg, version) | |
} | |
version_ok <- function(pkg, version = NULL) { | |
if (is.null(version)) return(TRUE) | |
pkgVersion(pkg) >= version | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_seed <- function() { | |
if (!exists(".Random.seed", envir = globalenv())) return(NULL) | |
get(".Random.seed", envir = globalenv()) | |
} | |
set_seed <- function(x) { | |
old <- cur_seed() | |
if (!is.null(x)) { | |
assign(".Random.seed", x, envir = globalenv()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
png <- function(path, dpi = NULL) { | |
meta <- attr(png::readPNG(path, native = TRUE, info = TRUE), "info") | |
if (!is.null(dpi)) meta$dpi <- rep(dpi, 2) | |
meta$path <- path | |
structure(meta, class = "png") | |
} | |
knit_print.png <- function(x, options) { | |
str(options) | |
knitr::asis_output(paste0( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
n <- as.integer(commandArgs(trailingOnly = TRUE)) | |
lines <- readLines(file("stdin")) | |
words <- tolower(unlist(strsplit(lines, "\\W+"))) | |
counts <- sort(table(words), decreasing = TRUE) | |
counts_n <- counts[1:n] | |
cat(sprintf("%8d %s\n", counts_n, names(counts_n)), sep = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
RObject makeExplicit(SEXP prom) { | |
if (TYPEOF(prom) != PROMSXP) { | |
stop("Not a promise"); | |
} | |
// recurse until we find the real promise, not a promise of a promise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(XML) | |
library(selectr) | |
xpath <- function(x) structure(x, class = "xpath") | |
sel <- function(x) xpath(css_to_xpath(x, prefix = "//")) | |
url <- "http://www.boxofficemojo.com/movies/?id=ateam.htm" | |
html <- content(GET(url), "parsed") |
OlderNewer