R Language (
ArrLanguage) is a
FunctionalProgramming language which has some relationship to
SchemeLanguage. It is described as an open source version of the S language (
EssLanguage).
- By the title, I thought it targeted pirates. It doesn't have GarbageCollection, rather it makes the bits walk the plank.
It is particularly developed as a set of
PowerfulAdHocDataProcessingTools for use by statisticians, and currently appears to be the lingua franca for academics researching statistical methods. Consequently there are many extensions available for statistical calculations. There is an extraordinary plotting library 'ggplot2' inspired by the
TheGrammarOfGraphics.
The "weirdest" characteristic of R is its that it uses a
CallByNeed evaluation scheme, despite
not being a
SingleAssignmentLanguage. Function arguments are not evaluated until referenced in the body of a function. You usually don't notice, but sometimes you do. For example:
makeAddarr <- function(addWhat) {
function (x) x + addWhat
}
addarrs <- list(makeAddarr(1), makeAddarr(2), makeAddarr(3))
for (a in addarrs) print(a(10))
prints 11, 12 and 13 as you might expect, but
for (i in 1:3) {
addarrs[[i]] <- makeAddarr(i)
}
for (a in addarrs) print(a(10))
prints 13, 13, and 13! The reason is that, for each adder, the value of addWhat is not computed until referenced in the inner function -- by which time "i" has already changed.
The
CallByNeed system is also exploited in writing things that act like
RuntimeMacros.
Much information is available at the
ComprehensiveArrArchiveNetwork (CRAN) - see
http://cran.r-project.org/
There is also background on wikipedia at
http://en.wikipedia.org/wiki/CRAN_%28R_programming_language%29#CRAN
It contains Sweave (
EssWeave) a
LiterateProgramming tool to combine R code with report documents.
SimplifiedWrapperAndInterfaceGenerator (SWIG) can be used to make calls to
CeeLanguage or
CeePlusPlus code.
There is also
ArrPy (RPy) to make links between R and
PythonLanguage.
Book: R in a Nutshell (
ArrInaNutshell) (
OreillyAndAssociates) explains some of the things which need explaining. --
JohnFletcher
Patrick Burns wrote "The R Inferno" which explains R from the pessimistic perspective of walking through all the pitfalls.
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
CategoryProgrammingLanguage CategoryStatistics CategoryFunctionalProgramming CategoryLiterateProgramming