btiffin
|
Posted: Wed Apr 16, 2008 10:09 pm Post subject: R Review and Recommendation |
|
|
R is a full featured and very mature Statistical Computing environment
R-project.org
An array processor, R takes large or small datasets and provides a plethora of analytical options. Based on S-Lang, R is completely GNU, meaning completely free. A well organized Comprehensive R Archive Network provides tools for users and developers, accessible directly from R scripts or the R console. Plotting is an important feature of the system and cross-platform is well supported across GNU/Linux, Mac OS/X and Windows.
code: | $ R
R> x <- rnorm(50) # generate a vector of 50 normalized random numbers
R> y <- rnorm(x) # generate the y's for and x,y mapping
R> plot(x,y) # plot it
R> # without seed, R guarantees reproducible random sequences for development and verification |
Matrices are handled easily, mixing string or factor and numerics in human friendly ways, or highly efficient binary forms. Reading tables, R, will examine the form and properly align column headings included in the input with the associated rows of data.
Given houses.dat as a text file (dataset) code: | Price Floor Area Rooms Age Cent.heat
01 52.00 111.0 830 5 6.2 no
02 54.75 128.0 710 5 7.5 no
03 57.50 101.0 1000 5 4.2 no
04 57.50 131.0 690 6 8.8 no
05 59.75 93.0 900 5 1.9 yes |
and evaluating code: | R> houses = read.table("houses.dat") |
you will have a nice matrix loaded and ready to analyze.
Note that here, each row comes with a record number. For loading without row labels, use code: | R> houses = read.table("houses.dat", header=TRUE) | and R will take care creating a vector of field names (factors) and rows of numeric data just as before. Internal R analysis of the input keeps everything easy from a user perspective.
Many, many type of plots including entire packages that make dealing with lat, long and elevation data a breeze. Plotting a nice battle field image with texturing, is fairly straight forward in R. A sample contour with perspective plot; code: |
z <- 2 * volcano # Exaggerate the relief
x <- 10 * (1:nrow(z)) # 10 meter spacing (S to N)
y <- 10 * (1:ncol(z)) # 10 meter spacing (E to W)
z0 <- min(z) - 20
z <- rbind(z0, cbind(z0, z, z0), z0)
x <- c(min(x) - 1e-10, x, max(x) + 1e-10)
y <- c(min(y) - 1e-10, y, max(y) + 1e-10)
fill <- matrix("green3", nr = nrow(z)-1, nc = ncol(z)-1)
fill[ , i2 <- c(1,ncol(fill))] <- "gray"
fill[i1 <- c(1,nrow(fill)) , ] <- "gray"
fcol <- fill
zi <- volcano[ -1,-1] + volcano[ -1,-61] +
volcano[-87,-1] + volcano[-87,-61] ## / 4
fcol[-i1,-i2] <-
terrain.colors(20)[cut(zi, quantile(zi, seq(0,1, len = 21)),
include.lowest = TRUE)]
par(mar=rep(.5,4))
persp(x, y, 2*z, theta = 110, phi = 40, col = fcol, scale = FALSE,
ltheta = -120, shade = 0.4, border = NA, box = FALSE) | |
(code from the R wiki at AddictedToR
There is a large community of contributed scripts in the CRAN.
Hundreds of sample datasets ship with R and access starts with a simple listing using R> data(). Part of this data being the Maunga Whau volcano elevation information shown here.
A serious number cruncher. Recommended for anyone involved with game theory, geophysical, data mining, statistical analysis, biology, fiscals, school, and so many others fields I'll stop now. Along with Python, R might make a nice C.V. entry on a job application to Google.
Plus, here is a little bit of cool; Cube
Cheers
And the main link once again; R-project.org |
|
|