Posts Tagged ‘ programming ’

Using Sparse Matrices in R

October 31, 2011
By
Using Sparse Matrices in R

Introduction I’ve recently been working with a couple of large, extremely sparse data sets in R. This has pushed me to spend some time trying to master the CRAN packages that support sparse matrices. This post describes three of them: the Matrix, slam and glmnet packages. The first two packages provide data storage classes for

Read more »

Creating an R package, using developer/productivity tools

October 27, 2011
By
Creating an R package, using developer/productivity tools

Couple of R programming (mainly infrastructure/workflow) related topics discussed at the Los Angeles R users group in a tutorial/demo-like form (targeted mainly to beginners) by Szilard Pafka and Jeroen Ooms: how easy it is to create a simple package for … Continue reading →

Read more »

The Psychology of Music and the ‘tuneR’ Package

October 25, 2011
By

Introduction This semester I’m TA’ing a course on the Psychology of Music taught by Phil Johnson-Laird. It’s been a great course to teach because (i) so much of the material is new to me and (ii) because the study of the psychology of music brings together so many of the intellectual tools I enjoy, including

Read more »

Another Mystery: sas7bdat != sd2

October 14, 2011
By

I received an email from a very inconvenienced statistician a few weeks ago. The problem was an old data file with the extension .sd2. Apparently, this is an obsolete data storage format used by past versions of SAS. A quick glance at the file contents revealed that this sd2 formatted file is incompatible with the

Read more »

Ghastly R code

September 27, 2011
By
Ghastly R code

My R package, R/qtl, contains about 33k lines of R code (and 21k lines of C code). Some of it is quite good; some of it is terrible. Here’s another example of the terrible. I’ve long needed to revise the function scantwo, for performing a two-dimensional genome scan for pairs of loci. I was looking

Read more »

Interacting with bioinformatics webservers using R

September 8, 2011
By
Interacting with bioinformatics webservers using R

In an ideal world, all bioinformatics tools would be made available via the Web as a web service with an API, as well as a standalone package to download for local use. This is rarely the case and sometimes, even where one or the other is available, factors such as cost come into play. So

Read more »

Seriously … why don’t math classes use computers?…

August 31, 2011
By

Seriously … why don’t math classes use computers? Excel, simple Python scripts, Mathematica / Sage, everything beyond the TI-83. Kids could be creating totally sweet visuals instead of cribbing formulae. And thinking instead of copying. I can sa...

Read more »

Seriously … why don’t math classes use computers?…

August 31, 2011
By

Seriously … why don’t math classes use computers? Excel, simple Python scripts, Mathematica / Sage, everything beyond the TI-83. Kids could be creating totally sweet visuals instead of cribbing formulae. And thinking instead of copying. I can sa...

Read more »

ggplot2 Version of Figures in “25 Recipes for Getting Started with R”

August 16, 2011
By
ggplot2 Version of Figures in “25 Recipes for Getting Started with R”

In order to provide an option to compare graphs produced by basic internal plot function and ggplot2, I recreated the figures in the book, 25 Recipes for Getting Started with R, with ggplot2.The code used to create the images is in separate paragraphs, allowing easy comparison.Read...

Read more »

Getters and setters in R

August 12, 2011
By

Tweet When I first started using R, one of the things that attracted me was its claim to be an object-oriented programming (OOP) language. Coming from a Java background, I was used to designing software with OOP concepts like encapsulation and inheritance but, when I turned my hand to R, I quickly...

Read more »