Skip to content

Instantly share code, notes, and snippets.

noamross /
Created April 14, 2014 23:51
Rough draft of post on vectorization.

% Vectorization without Condescension % Noam Ross % 14-04-07 09:09:18

Here are my notes from a recent talk I gave on vectorization at a Davis R Users' Group meeting. Thanks to Vince Buffalo, John Myles White, and Hadley Wickham for their input as I was preparing this.

Beginning R users are often told to "vectorize" their code. Here, I try to explain why vectorization can be advantageous in R by showing how R works under the hood.

Now, remember, premature optimization is the root of all evil (Knuth). Don't start re-writing your code unless the time saved is going to be worth the time invested. Other approaches, like finding a bigger machine or parallelization, could give you more bang for the buck in terms of programming time. But if you und

noamross / get_peerj_subject_dois.R
Created June 12, 2014 11:54
Grab DOIs of all PeerJ articles from a subject area
#Get DOIs for subject area from PeerJ
#JSON for Ecology articles (paginated):
ecol_url = ""
dois = list()
repeat {
noamross / slowGET.R
Created June 26, 2014 20:15
slowGET - A throttled version of GET
throttle = new.env(parent = emptyenv())
throttle$recent = data.frame(domain = character(), last_visit = character())
#' A throttled version of GET
#' This uses \code{httr::GET} to fetch a web page, but throttles based on domains.
#' \code{slowGET} keeps a list of domains recently accessed by itself in a
#' separate environment. If a domain has been accessed since \code{pause}
#' seconds ago, it will delay execution until that time has passed
noamross /
Last active August 29, 2015 14:12
Visually Impaired Bioinformatics Graduate Student Seeking R Programming Tutoring

I received the following inquiry from Thomas Hahn, a visually impaired graduate student seeking an R programming tutor. Anyone interested in working with Thomas can contact him at

I am a visually impaired bioinformatics graduate student using microarray data for my master’s thesis aimed at deciphering the mechanism by which the yeast wild type can suppress the rise of free reactive oxygen species (ROS) induced by caloric restriction (CR) but the Atg15 and Erg6 knockout mutant cannot.

Since my remaining vision is very limited I need very high magnification. But that makes my visual field very small. Therefore I need somebody to guide me remotely through the R environment and teach me how to best use the R packages for bioinformatics, especially for microarray analysis, next generation sequencing and constructing gene and pathway interaction networks. This is very difficult for me to figure out without as

noamross /
Last active August 29, 2015 14:16
Draft MSL AMA blog post

We Run Scientific Computing Communities, Ask Us Anything

How do you create and nurture communities of people who teach, learn, and collaborate to build scientific computing skills? That's a question central to much of MSL's work, especially as we embark on new long-term training initiatives.

On March 24, 6-8PM EST, we're hosting an online panel discussion on this topic on our forum. It's Ask-Us-Anything, MSL-style. We want to spur knowledge-sharing among those who facilitate local learning communities. Are you part of a study group, users' group, or other community of people who help each other with these skills? Do you want to start one or improve how yours works? Please join us!

Our panelists each work on local initiatives to train computing skills and build learning communities. We'll be talking about our models, approaches, and challenges, and taking questions and comments about how to build such communities el

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
noamross / test.R
Created June 22, 2015 20:14
test for import::from
myfunc <- function(x) {
x + 1
noamross / disease_tweeps.R
Last active August 29, 2015 14:23
I wanted to make a list of my disease ecology followers and followees on twitter, so...
# Authenticate with twitter
# consumer/access keys and secrets for the twitter API must be defined elsewhere
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
# Get all my followers and followees
noamross / gist:b902d1cda9bedb1bd060
Last active August 29, 2015 14:24
Capturing all console output, including messages from C programs, etc
conn <- textConnection("printed_output", "w", local = TRUE)
sink(conn, type=c("output"))
sink(conn, type=c("message"))
# This will append the text to the printed_output variable, so clear it beforehand.