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 hidden or 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
| members <- c("Bill Venables", "Brian Ripley", "Douglas Bates", "Duncan Murdoch", "Duncan Temple Lang", "Friedrich Leisch", "John Chambers", "John Fox", "Kurt Hornik", "Luke Tierney", "Martin Maechler", "Martyn Plummer", "Paul Murrell", "Peter Dalgaard", "Robert Gentleman", "Roger Bivand", "Ross Ihaka", "Simon Urbanek", "Stefano Iacus", "Thomas Lumley") | |
| core <- c("Douglas Bates", "John Chambers", "Peter Dalgaard", "Seth Falcon", "Robert Gentleman", "Kurt Hornik", "Stefano Iacus", "Ross Ihaka", "Friedrich Leisch", "Uwe Ligges", "Thomas Lumley", "Martin Maechler", "Duncan Murdoch", "Paul Murrell", "Martyn Plummer", "Brian Ripley", "Deepayan Sarkar", "Duncan Temple Lang", "Luke Tierney", "Simon Urbanek") | |
| sort(setdiff(members, core)) | |
| sort(setdiff(core, members)) |
This file contains hidden or 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(jsonlite) | |
| find_endorsements <- function(x) { | |
| r <- GET("https://www.linkedin.com/ta/skill" ,query = list(query = x)) | |
| stop_for_status(r) | |
| json <- content(r, "parsed") | |
| vapply(json$resultList, "[[", "displayName", FUN.VALUE = character(1)) |
This file contains hidden or 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") |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) | |