Publications by Karl Broman
Why hadn’t I written a function for that?
I’m often typing the same bits of code over and over. Those bits of code really should be made into functions. For example, I’m still using base graphics. (ggplot2 is on my “to do” list, really!) Often some things will be drawn with a slight overlap of the border of the plotting region. And in heatmaps with image, the border is often obsc...
1509 sym R (45 sym/1 pcs) 4 img
UseR 2014, days 3-4
Three weeks ago, I’d commented on the first two days of the UseR 2014 conference. I’m finally back to talk about the second half. Dirk Eddelbuettel on Rcpp Dirk Eddelbuettel gave a keynote on Rcpp [slides]. The goal of Rcpp is to have “the speed of C++ with the ease and clarity of R.” He gave a series of examples that left me (who still u...
4300 sym 4 img
Testing an R package’s interactive graphs
I’ve been working on an R package, R/qtlcharts, with D3-based interactive graphs for quantitative trait locus mapping experiments. Testing the interactive charts it produces is a bit of a pain. It seems like I pretty much have to just open a series of examples in a web browser and tab through them manually, checking that they look okay, that th...
1806 sym 4 img
Yet another R package primer
Hadley Wickham is writing what will surely be a great book about the basics of R packages. And Hilary Parker wrote a very influential post on how to write an R package. So it seems like that topic is well covered. Nevertheless, I’d been thinking for some time that I should write another minimal tutorial with an alliterative name, on how to turn...
1159 sym 4 img
Notifications from R
You just sent a long R job running. How to know when it’s done? Have it notify you by beeping, sending you a text, or sending you a notification via pushbullet! beepr You can use Rasmus Bååth’s beepr package to have your computer play a sound. Install it from CRAN with install.packages("beepr") Then, at the bottom of your script, load the...
4163 sym R (978 sym/11 pcs) 4 img
Error notifications from R
I’m enthusiastic about having R notify me when my script is done. But among my early uses of this, my script threw an error, and I never got a text or pushbullet about that. And really, I’m even more interested in being notified about such errors than anything else. It’s relatively easy to get notified of errors. At the top of your script, ...
1535 sym R (151 sym/1 pcs) 4 img
Initial steps towards reproducible research
In anticipation of next week’s Reproducible Science Hackathon at NESCent, I was thinking about Christie Bahlai’s post on “Baby steps for the open-curious.” Moving from Ye Olde Standard Computational Science Practice to a fully reproducible workflow seems a monumental task, but partially reproducible is better than not-at-all reproducible,...
1160 sym 4 img
Randomized Hobbit
@wrathematics pointed me to his ngram R package for constructing and simulating from n-grams from text. I’d recently grabbed the text of the hobbit, and so I applied it to that text, with amusing results. Here’s the code I used to grab the text. library(XML) stem <- "http://www.5novels.com/classics/u5688" hobbit <- NULL for(i in 1:74) { ...
1634 sym R (466 sym/3 pcs) 4 img
It’s not you, it’s me
Somehow when my code stops working, my first (and second, and third) reaction is to blame everything except my own code. (“It’s not me, it’s you.”) And almost always, it’s my own code that’s the problem (hence the title of this post). I spent the day trying to resolve a bug in my early-in-development R package, qtl2geno. In the process...
4099 sym R (80 sym/1 pcs) 4 img
Session info from R/Travis
For the problem I reported yesterday, in which my R package was working fine locally but failing on Travis, the key solution is to run update.packages(ask=FALSE) locally, and maybe even update.packages(ask=FALSE, type="source") to be sure to grab the source of packages for which binaries are not yet available. I now know to do that. In addition, ...
2248 sym R (417 sym/1 pcs) 4 img