Skip to navigation

Archive for the 'R' Category

Use R to help with lottery drawing

Thursday, January 7th, 2010

When you start using R, it can be confusing that if you assign something to an object you do not get visual feedback: x x [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 You can exploit this fact for doing a quick-and-dirty lottery. Assume you have a [...]

Nice R example from r-help

Thursday, November 5th, 2009

I don’t know the first thing about programming, but sometimes you see something and appreciate how elegant it is. This small solution from r-help is a good example. Someone wanted, given a vector c(‘p’,'p’,'t’,'t’,'t’,'p’,'k’,'t’) to produce NA NA 1 2 3 test

R: watch out when comparing vectors using “==”

Friday, September 25th, 2009

This question was on the R-help mailing list today: I have a data frame “test”: test test$total [1] 7 7 8 8 9 9 10 10 to this: > rep(needed,length.out=length(test$total)) [1] 7 9 7 9 7 9 7 9 The two vectors just happen to coincide at test$total[1] and test$total[6]. The recycling is of course [...]

How to install RGoogleDocs (on Ubuntu)

Monday, September 14th, 2009

RGoogleDocs is not available from CRAN, but from Omegahat.org. To install, sudo R, then install.packages(“RGoogleDocs”, repos = “http://www.omegahat.org/R”) RGoogleDocs requires RCurl, and will automatically install it. However, for me, this resulted in the error message: checking for curl-config… no Cannot find curl-config and RGoogleDocs was not installed. This is in fact in the RCurl FAQ. [...]

Emacs with ESS and AucTeX on Windows

Monday, September 14th, 2009

I will have to use MS Windows for my new job, at least some of the time. I’ll put related posts in a new “MS Windows” category. If you use R, you most likely want ESS (Emacs Speaks Statistics) for your GNU Emacs. If you use LaTeX, you will also want AucTeX. I highly recommend [...]