# Welcome to R

My first impression of R is that it is a quite exotic beast.

Data types seem a bit screwed up.

There’s no scalar types – everything is a vector. Even numbers are just vectors with one element.

Vectors can be two-dimensional – matrices.

For both vectors and lists (well, and everything else I think) indexes start at 1, not 0 like all other ALGOL-derived languages.

Then there’s lists. Which are totally not like vectors. Lists are more like hash arrays or named vectors, whichever analogy you prefer. `someList[3]`

means something but `someList$someProperty`

also means something (most of the times, a vector).

And what’s the matrix equivalent of lists? Data frames. Lists are for vectors what data frames are for matrices.

But then there’s some nice things.

Documentation is everywhere. `?function`

shows help and `examples(function)`

shows examples. Yes, because help may not be enough. But maybe the examples are still not enough as well. Before heading to google, why not search inside R Just `help.search(\"multivariate normal\")`

and you’re googling inside R anyways.

If you’re computer is stupidly slow, you can start a vanilla version of R with `r --vanilla`

.

Oh, and did I mention if you are referencing fields in an object or list, you don’t need to reference the whole field name? yes, `for kids <- list(names=c(\"jack\", \"jill\"), ages=c(12,23))`

, `kids$names`

produces the same output as `kids$n`

.

Oh, oh, and did I mention there’s objects and classes? This is accomplished simply by having lists with a property called… class.

And you have seen already that the assignment operator is `<--`

instead of `=`

. This is a bit weird though.

So, all in all, I like it so far. Let’s see what I say about it in a few weeks.