## Statistical programming with R

Three part series on R that's of interest for domain specific PL development. First parts can be found at Part 1: Dabbling with a wealth of statistical facilities and
Part 2: Functional programming and data exploration. (Part three is still in the works). R is a suite of software facilities for data manipulation, calculation and graphical display, which is quite useful for statistical analysis. It builds upon the S language developed originally at Bell Labs.

A three-part series, ...introduces you to R, a rich statistical environment, released as free software. It includes a programming language, an interactive shell, and extensive graphing capability. What's more, R comes with a spectacular collection of functions for mathematical and statistical manipulations -- with still more capabilities available in optional packages... The (GPL'd) R programming language has two parents, the proprietary S/S-PLUS programming language, from which it gets most of its syntax, and the Scheme programming language, from which it gets many (more subtle) semantic aspects.
R and S were touched on fairly briefly in the LtU discussion about Regression Analysis. A more detailed introduction can found be found at An Introduction to R.

## Comment viewing options

### Playing around

Can't quite get a good lock on the idiom used for OOP in R/S as there seems to be some variance in the prefered manner. Be that as it may, I put together OO polymorphism shape example in R.

Biggest hassle is having to broadcast the genericity of each of the methods so that they are polymorphically accessible. Means that the method names are not limited to the class level in scope.

And while I'm at it, mind as well show the recursion example:

fact <- function(n) {
if (n == 1) {
1
} else {
n * fact(n-1)
}
}
fact(5)

Anyhow, that should be enuf to demonstrate that it is a full language (not to mention that it has proper closures).

[Edit Note: fix the escaping]

### Another article on R

Still awaiting on part 3 of the above series. In the meantime, there's a timely article on Analyzing Baseball Stats with R for those would be sabermetricians - though probably not in time to save the Cardinals from their demise.

### DSLs for statistics

Most people, even those persumed to have scientific training, tend to make fools of themselves when doing statistics. Does anyone know of a DSL that helps overcome this problem, say a statistical DSL for medical research?

### Previously, on LtU...

That's impressive: I asked the question in 2004, you posted a relevant answer in a different thread in 2006, and 2009 this thread resurfaced so the question and answer could be reunited!

### While IBAL is interesting,

While IBAL is interesting, my original question was more about statistical analysis of data (rather than probabilistic models).

### ESS : Emacs Speaks Statistics

ESS seems like a useful tool if you are planning on playing with R.

### Was the third part ever

Was the third part ever published?

Thanks.