The R language, for programmers
r-languageprogrammingstatistical-computingdata-typesvectors
Abstraction: R language quirks and idioms explained for experienced programmers
Key points:
- R should be understood as a statistical environment that has a programming language (like VBA for Excel), not as a general-purpose language
- Primary data type is the vector (1-indexed, FORTRAN column-major order); no scalar type — single numbers are length-1 vectors; shorter vectors are recycled when added to longer ones
- Assignment uses
<-; dot used as name separator (no OOP meaning);$accesses named list elements (analogous to dot in other languages);T/Fare reassignable variables, not reserved keywords — useTRUE/FALSE NA(not applicable, missing data) is distinct fromNaN;is.na()returns TRUE for both; functions must handle NA in any vector argument- Negative indices return a copy of the vector with that element removed (not Python-style reverse indexing)
- Distribution functions follow d/p/q/r prefix convention: density, CDF, quantile, random sample (e.g.,
dnorm,rnorm)
Connections: R Programming · Statistical Computing
Source: http://www.johndcook.com/blog/r_language_for_programmers/