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(ggplot2) | |
add_cat <- function(width = 400, height = 400){ | |
r <- GET(paste("http://theoldreader.com/kittens", width, height, sep = "/")) | |
stop_for_status(r) | |
img <- content(r) | |
bw <- 0.2989*img[,,1] + 0.5870*img[,,2] + 0.1140*img[,,3] | |
lighter <- bw + (0.7 * (1-bw)) | |
annotation_raster(lighter, xmin=-Inf, xmax=Inf, ymin=-Inf, ymax=Inf) |
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
require(proto) | |
stat_qqline <- function (mapping = NULL, data = NULL, geom = "abline", position = "identity", | |
distribution = qnorm, dparams = list(), na.rm = FALSE, ...) { | |
StatQqline$new(mapping = mapping, data = data, geom = geom, position = position, | |
distribution = distribution, dparams = dparams, na.rm = na.rm, ...) | |
} | |
StatQqline <- proto(ggplot2:::Stat, { | |
objname <- "qqline" |
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(plyr) | |
library(ggplot2) | |
# from: http://www.codeproject.com/Articles/18149/Draw-a-US-Flag-using-C-and-GDI | |
star_coords <- function(x, y, r, r1){ | |
a <- 72 * pi /180 | |
b <- a/2 | |
df <- data.frame( | |
x = x + c(0, r1*sin(b), r*cos(pi/2 - a), r1*cos(a + b - pi/2), r*sin(b), | |
0, -r*sin(b), -r1*cos(a + b - pi/2), - r*cos(pi/2 - a), -r1*sin(b)), |
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
fitted_variofit <- function (x, max.dist, scaled = FALSE, ...) { | |
my.l <- list() | |
if (missing(max.dist)) { | |
my.l$max.dist <- x$max.dist | |
if (is.null(my.l$max.dist)) | |
stop("argument max.dist needed for this object") | |
} | |
else my.l$max.dist <- max.dist | |
if (any(x$cov.model == c("matern", "powered.exponential", | |
"cauchy", "gencauchy", "gneiting.matern"))) |
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(shiny) | |
library(ggplot2) | |
# Define server logic required to generate and plot a random distribution | |
shinyServer(function(input, output) { | |
generate_data <- reactive( | |
function(){ | |
mu <- c(input$mu_1, input$mu_2, input$mu_3) | |
tmp <- data.frame(len = rnorm(length(mu) * input$n, | |
mean = rep(mu, each = input$n), |
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
require(proto) | |
stat_qqline <- function (mapping = NULL, data = NULL, geom = "abline", position = "identity", | |
distribution = qnorm, dparams = list(), na.rm = FALSE, ...) { | |
StatQqline$new(mapping = mapping, data = data, geom = geom, position = position, | |
distribution = distribution, dparams = dparams, na.rm = na.rm, ...) | |
} | |
StatQqline <- proto(ggplot2:::Stat, { | |
objname <- "qqline" |
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
#------------------------------------------------------------ | |
# REVOLUTION ANALYTICS WEBINAR: INTRODUCTION TO R FOR DATA MINING | |
# February 14, 2013 | |
# Joseph B. Rickert | |
# Technical Marketing Manager | |
# | |
# BIG DATA with RevoScaleR | |
# | |
# Copyright: Revolution Analytics |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='http://ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script> | |
<style> | |
.rChart { | |
display: block; |
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
easterEgg.BadWorder.list={ | |
"4r5e":1, | |
"5h1t":1, | |
"5hit":1, | |
a55:1, | |
anal:1, | |
anus:1, | |
ar5e:1, | |
arrse:1, | |
arse: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
ngrams.tokenizer <- function(x, n = 2) { | |
trim <- function(x) gsub("(^\\s+|\\s+$)", "", x) | |
terms <- strsplit(trim(x), split = "\\s+")[[1]] | |
ngrams <- vector() | |
if (length(terms) >= n) { | |
for (i in n:length(terms)) { | |
ngram <- paste(terms[(i-n+1):i], collapse = " ") | |
ngrams <- c(ngrams,ngram) | |
} | |
} |
OlderNewer