Skip to content

Instantly share code, notes, and snippets.

Jason Bryer jbryer

View GitHub Profile
@dsparks
dsparks / voronoi_raster.R
Created Oct 30, 2012
Image Manipulation, Part 3
View voronoi_raster.R
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ReadImages", "reshape", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg",
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg",
@jverzani
jverzani / singleton
Created Mar 1, 2012
example of singleton pattern
View singleton
## Singleton pattern
Singleton <- setRefClass("Singleton",
fields=list(
Class="ANY",
instance="ANY"
),
methods=list(
initialize=function(...) {
"Override this by defining Class"
@thomasjensen
thomasjensen / rbloggerAnalysis.r
Created Jan 6, 2012
analysing the data scraped from r-bloggers.com
View rbloggerAnalysis.r
#read the libraries
library(plyr)
library(ggplot2)
library(xtable)
#set the working direcotry to where you saved the output.csv file from the previous post
setwd("/.../")
#read the data
data <- read.csv("output.csv")
@jbryer
jbryer / RPackageInstaller.R
Created Nov 23, 2011
Install basic set of R packages
View RPackageInstaller.R
.libPaths() #By default, R will install packages to the first element
#This script will install some very common R packages.
repos = 'http://cran.r-project.org' #Main CRAN
repos.win = 'http://www.stats.ox.ac.uk/pub/RWin' #Site provides some prebuilt binaries for Windows
repos.rforge = 'http://r-forge.r-project.org'
libraries = c('Deducer', 'devtools', 'doBy', 'foreign', 'gdata', 'ggplot2', 'gmaps',
'Hmisc', 'JGR', 'maps', 'mapdata', 'mapproj', 'maptools', 'proto', 'psych', 'R2wd',
'Rcmdr', 'RCurl', 'reshape', 'RODBC', 'roxygen2', 'seqinr', 'sm', 'sp',
You can’t perform that action at this time.