analogsea - an R client for the Digital Ocean API

I think this package name is my best yet. Maybe it doesn’t make sense though? At least it did at the time… Anyway, the main motivation for this package was to be able to automate spinning up Linux boxes to do cloud R/RStudio work. Of course if you are a command line native this is all easy for you, but if you are afraid of the command line and/or just don’t want to deal with it, this tool will hopefully help. ...

May 28, 2014 · 5 min · Scott Chamberlain

Logistic plot reboot

Someone asked about plotting something like this today I wrote a few functions previously to do something like this. However, since then ggplot2 has changed, and one of the functions no longer works. Hence, I fixed opts() to theme(), theme_blank() to element_blank(), and panel.background = element_blank() to plot.background = element_blank() to get the histograms to show up with the line plot and not cover it. The new functions: loghistplot <- function(data) { names(data) <- c('x','y') # rename columns # get min and max axis values min_x <- min(data$x) max_x <- max(data$x) min_y <- min(data$y) max_y <- max(data$y) # get bin numbers bin_no <- max(hist(data$x, plot = FALSE)$counts) + 5 # create plots a <- ggplot(data, aes(x = x, y = y)) + theme_bw(base_size=16) + geom_smooth(method = "glm", family = "binomial", se = TRUE, colour='black', size=1.5, alpha = 0.3) + scale_x_continuous(limits=c(min_x,max_x)) + theme(panel.grid.major = element_blank(), panel.grid.minor=element_blank(), panel.background = element_blank(), plot.background = element_blank()) + labs(y = "Probability\n", x = "\nYour X Variable") theme_loghist <- list( theme(panel.grid.major = element_blank(), panel.grid.minor=element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank(), axis.ticks = element_blank(), panel.border = element_blank(), panel.background = element_blank(), plot.background = element_blank()) ) b <- ggplot(data[data$y == unique(data$y)[1], ], aes(x = x)) + theme_bw(base_size=16) + geom_histogram(fill = "grey") + scale_y_continuous(limits=c(0,bin_no)) + scale_x_continuous(limits=c(min_x,max_x)) + theme_loghist + labs(y='\n', x='\n') c <- ggplot(data[data$y == unique(data$y)[2], ], aes(x = x)) + theme_bw(base_size=16) + geom_histogram(fill = "grey") + scale_y_continuous(trans='reverse', limits=c(bin_no,0)) + scale_x_continuous(limits=c(min_x,max_x)) + theme_loghist + labs(y='\n', x='\n') grid.newpage() pushViewport(viewport(layout = grid.layout(1,1))) vpa_ <- viewport(width = 1, height = 1, x = 0.5, y = 0.5) vpb_ <- viewport(width = 1, height = 1, x = 0.5, y = 0.5) vpc_ <- viewport(width = 1, height = 1, x = 0.5, y = 0.5) print(b, vp = vpb_) print(c, vp = vpc_) print(a, vp = vpa_) } logpointplot <- function(data) { names(data) <- c('x','y') # rename columns # get min and max axis values min_x <- min(data$x) max_x <- max(data$x) min_y <- min(data$y) max_y <- max(data$y) # create plots ggplot(data, aes(x = x, y = y)) + theme_bw(base_size=16) + geom_point(size = 3, alpha = 0.5, position = position_jitter(w=0, h=0.02)) + geom_smooth(method = "glm", family = "binomial", se = TRUE, colour='black', size=1.5, alpha = 0.3) + scale_x_continuous(limits=c(min_x,max_x)) + theme(panel.grid.major = element_blank(), panel.grid.minor=element_blank(), panel.background = element_blank()) + labs(y = "Probability\n", x = "\nYour X Variable") } Install ggplot2 and gridExtra if you don’t have them: ...

May 22, 2014 · 2 min · Scott Chamberlain

cowsay - ascii messages and warnings for R

The history Cowsay is a terminal program that generates ascii pictures of a cow saying what you tell the cow to say in a bubble. See the Wikipedia page for more information: https://en.wikipedia.org/wiki/Cowsay - Install cowsay to use in your terminal (on OSX): brew update brew install cowsay Type cowsay hello world!, and you get: ______________ < hello world! > -------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || Optionally, you can install fortune to get pseudorandom messages from a database of quotations. On OSX do brew install fortune, then you can pipe a fortune quote to cowsay: ...

February 20, 2014 · 4 min · Scott Chamberlain

rgauges - fun with hourly web site analytics

Gaug.es is a really nice looking analytics platform as an alternative to Google Analytics. It is a paid service, but not that expensive really. We’ve made an R package to interact with the Gaug.es API called rgauges. Find it on Github and on CRAN. Although working with the Gaug.es API is nice and easy, they don’t keep hourly visit stats and provide those via the API, so that you have to continually collect them yourself if you want them. That’s what I have done for my own website. ...

January 17, 2014 · 5 min · Scott Chamberlain

Jekyll - an intro

I started using Jekyll when I didn’t really know HTML, CSS, or Ruby - so I’ve had to learn a lot - but using Jekyll has been a great learning experience for all those languages. I’ve tried to boil down steps to building a Jekyll site or blog to the minimal steps: Install Jekyll Mac/Linux/Unix: Install dependencies: Ruby RubyGems Install Jekyll using RubyGems gem install jekyll (you may need to do sudo...) If you’re having trouble installing, see the troubleshooting page. Windows: Jekyll doesn’t officially support installation on Windows - follow these steps for a Windows install. ...

November 20, 2013 · 3 min · Scott Chamberlain

Guide to using rOpenSci packages during the US Gov't shutdown

Note: This is cross-posted from the rOpenSci blog, which will update with this post when our technical snafu is fixed. With the US government shut down, many of the federal government provided data APIs are down. We write R packages to interact with many of these APIs. We have been tweeting about what APIs that are down related to R pacakges we make, but we thought we would write up a proper blog post on the issue. ...

October 8, 2013 · 3 min · Scott Chamberlain

Taxonomy data from the web in three languages

Eduard Szöcs and I started developing a taxonomic toolbelt for the R language a while back , which lets you interact with a multitude of taxonomic databases on the web. We have a paper in F1000Research if you want to find out more (see here). I thought it would be fun to rewrite some of taxize in other languages to learn more languages. Ruby and Python made the most sense to try. I did try others (Julia, Node), but gave up on those for now. The goal here isn’t to port taxize to Python and Ruby right now - it’s for me to learn myself some coding. ...

September 27, 2013 · 2 min · Scott Chamberlain

govdat - SunlightLabs and New York Times Congress data via R

I started an R package a while back, and a few people have shown interest, so I thought it was time to revist the code. govdat is an interface to various APIs for government data: currently the Sunlight Labs APIs, and the New York Times congress API. Returned objects from functions are simple lists. In future versions of govdat, I may change how data is returned. The following are examples (which is also the package vignette) of using the Sunlight Labs API. I will add examples of using the New York Times Congress API once their site is up again; I’m doing this on 2013-08-28, just after the takedown of their site. ...

August 28, 2013 · 6 min · Scott Chamberlain

Working with climate data from the web in R

I recently attended ScienceOnline Climate, a conference in Washington, D.C. at AAAS. You may have heard of the ScienceOnline annual meeting in North Carolina - this was one of their topical meetings focused on Climate Change. I moderated a session on working with data from the web in R, focusing on climate data. Search Twitter for #scioClimate for tweets from the conference, and #sciordata for tweets from the session I ran. The following is an abbreviated demo of what I did in the workshop showing some of what you can do with climate data in R using our packages. ...

August 17, 2013 · 5 min · Scott Chamberlain

R ecology workshop

After my presentation yesterday to a group of grad students on R resources, I did a presentation today on intro to R data manipulation, visualizations, and analyses/visualizations of biparite networks and community level analyses (diversity, rarefaction, ordination, etc.). As I said yesterday I’ve been playing with two ways to make reproducible presentations in R: RStudio’s presentations built in to RStudio IDE, and Slidify. Yesterday I went with RStudio’s product - today I used Slidify. See the Markdown file for the presentation here. ...

July 31, 2013 · 1 min · Scott Chamberlain