What is your favorite R feature?

(This article was first published on cloudnumbers.com » R-project, and kindly contributed to R-bloggers)

R (www.r-project.org) is a free and strongly functional language and environment for statistical computing. You can explore data sets, make graphical displays of data, run statistical simulations and many more. If you never used R you should give it a try!

R beginners:
There are many courses, slides and tutorials available for R beginners. We are not planning to add another one to this list. Here we provide you with an incomplete list of nice R beginners sessions. You can also follow our list of nice R features, start the preinstalled R at cloudnumbers.com, copy and paste the following commands into the cloudnumbers.com’s web console and enjoy the diversity of R.

 

Nice R features:
Here we start a list of nice R features which present the diversity and power of R. Please feel free to add comments with your favorite R code snipset.

 

R as a calculator:
R provides you with all functionality of a powerful pocket calculator. All standard functions (powers, exponential, squareroot, logarithm, etc.) are built-in. Here are some examples:

(17-3) / (3-1) + 1
3*4 - 7 + 1.5
1.8^2 * exp(0.5) - sqrt(2.4)

You can also assign values to variables and use them for later computations:

x <- 1.8^2
y <- exp(0.5)
z <- x*y - sqrt(2.4)
z

R for visualization:
R is an environment for statistical computing and graphics! Draw star plots or segment diagrams of a multivariate data set “mtcars” (default data set in R).

palette(rainbow(12, s = 0.6, v = 0.75))
mtcars
stars(mtcars[, 1:7], len = 0.8, key.loc = c(12, 1.5),
main = "Motor Trend Cars", draw.segments = TRUE)

Another nice example is the “The Maunga Whau Volcano plot”. A contour plot using heat colors. The dataset volcano is one of the default datasets in R.

volcano
x <- 10*(1:nrow(volcano)); x.at &lt;- seq(100, 800, by=100)
y <- 10*(1:ncol(volcano)); y.at &lt;- seq(100, 600, by=100)
# Using Terrain Colors
image(x, y, volcano, col=terrain.colors(100),axes=FALSE)
contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="brown")
axis(1, at=x.at)
axis(2, at=y.at)
box()
title(main="Maunga Whau Volcano", sub = "col=terrain.colors(100)", font.main=4)


More very nice R plots including example code and data are available in the R graph gallery.

R help system:
R provides you with a very flexible help system. You can search for help inside all loaded packages using the command help() or use the simple question mark command “?commandName”. Here are some examples:

help(lm)
?lm
?"for"
?"[["
args("lm")
?volcano
help.search("regression")
RSiteSearch("cloudnumbers.com")

 

We will come up with the second part of our favorite R features at the end of the week: R programming, libraries and statistical analyses, biological data analyses with Bioconductor and high-performance computing with R.

Please feel free to add comments with your favorite R code snipset.

To leave a comment for the author, please follow the link and comment on his blog: cloudnumbers.com » R-project.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags:

Comments are closed.