Skip to navigation

Archive for the 'R' Category

R: create several plots with automatic generation of filenames in a loop

Tuesday, September 8th, 2009

Found on stackoverflow.com. I didn’t know about this way to make R automatically generate filenames for a series of plots: jpeg(“~/tmp/rplots/foo%02d.jpg”) for (i in 1:5) { plot(i,ylim=c(0,6)) } dev.off() I’m actually not sure whether R does this, or the Linux shell.

R flashmob #2 at stackoverflow.com

Tuesday, September 8th, 2009

This just in from Dan’s Decision Science News: Tonight at exactly 18:04 UK time, login at stackoverflow.com, post three questions you always wanted to ask about R, make sure you tag them “R”, and possibly stick around to answer some questions and to vote for good questions and answers. Sign the guestbook. More details at [...]

R: Installing weaver to cache Sweave code chunks

Thursday, May 28th, 2009

The package weaver lets you cache code chunks in your .Rnw file so the computations don’t have to be repeated if you only make small changes to the document — potentially a huge timesaver. If you simply try to install it using install.packages(), you will get the message that the package weaver cannot be found. [...]

R: lme4/ Matrix not finding “libRlapack.so”

Friday, March 20th, 2009

I had a problem in R when trying to load the package lme4 on Xubuntu Intrepid: > library(lme4) Loading required package: Matrix Loading required package: lattice Error in dyn.load(file, DLLpath = DLLpath, …) : unable to load shared library ‘/usr/local/lib/R/site-library/Matrix/libs/Matrix.so’: libRlapack.so: cannot open shared object file: No such file or directory Error: package ‘Matrix’ could [...]

R: Logical operators: Beware of the difference between “&&” and “&”

Friday, September 12th, 2008

There’s a tricky bit about R‘s logical operators, and though it’s described in the help pages that you get when you type, for example, ?”&” I still fall from it from time to time. (I think it has to do with my rudimentary knowledge and usage of “&&” for if-statements in bash shell scripts. Below [...]