In this post, I give a brief and basic example of how to import a file into R and then …Continue reading »

R news and tutorials contributed by (552) R bloggers

Conrad Sanderson released version 1.99.5 of Armadillo yesterday. This provides the fifth release candidate en route to version 2.0.0. He was even kind enough to post on rcpp-devel about it too as it entails some minor API changes. His version 1.99.5 ...

In comments on a recent post, "Ben" and Tal Galili very sensibly asked if I could make R code available for the econometric analysis in my posts, in addition to EViews code. I'll be trying to do this wherever I can, given the time constraints.The important point implicit in these comments is that R is free, open-source, software, whereas...

The latest issue of the R Journal is out, and as always includes many useful articles about using R and R packages. Articles in Volume 3/1 dive into topics including creating test for R packages with test_that; dealing with times, time zones, dates and holidays with timeDate; social network analysis of mailing lists through text mining; creating choropleths and...

A while back, while reading chapter 4 of Using R for Introductory Statistics, I fooled around with the mtcars dataset giving mechanical and performance properties of cars from the early 70's. Let's plot this data as a hierarchically clustered heatmap.# scale data to mean=0, sd=1 and convert to matrix mtscaled <- as.matrix(scale(mtcars))# create...

Volume 3/1 of The R Journal has been released. It of course has articles about using R. In addition it has a feature that I highly support. In preparation for the UseR! Conference 2011 August 16-18 in Coventry there are two Help Desk articles on making a good technical presentation. Technical presentation Rob Hyndman writes … Continue reading...

Today, in one of my more productive days, I managed to create a sleek R script that plotted several histograms in a lattice, allowing for easy identification of the underlying trend. Although the majority of the time taken consisted of collecting the data and making various adjustments, it took a not inconsiderable amount of work to write the...

The most recent issue of The R Journal was recently published. If you're not a regular reader, you should at least check out the following three contributed articles (listed in order of appearance).Rmetrics - timeDate PackageDifferential Evoluti...

This crashes R (sometimes):1 2 f = function( 3 a = {x <- y <- z <- w <- t <- u <- 7} 4 ) environment() 5 6 for (i in 1:1000) { ...

Christian Gunning has a great example of using Rcpp to speed up a for loop in R. For his agent-based simulation, Christian needed to repeatedly call the rbinom function in a loop. (Unfortunately, you can't pass a vector to the size argument, which would have solved the problem.) Using the aaply function (from the plyr package) took about 38...

What if we want to extend the behavior of one item with another? Or, to put it another way, what if we want one item to be able to grab the functionality of another?It turns out we can (almost) get this behavior without modifying the item constructor at all. Here's how you do the grabbing:

Should the world of R Wikibooks require a precis on truncated distributions, marijuana prices, or an obtusely coded method to visualize orthogonal least squares (spoiler alert: dot products are easier!), I’m your man! I hereby release all of the content and code in the R stuff category under the cc-by-sa copyright license. You can do…

The June 2011 issue of The R Journal contains an article on the R package digitize (link to pdf) by Timothée Poisot. This might prove to be a handy tool if you occasionally find yourself needing to retrieve data points from figures in old articles for...

Today, the first issue of the third volume of The R Journal was published: http://journal.r-project.org/current.html. The R Journal intends to reach a wide audience and is one of the main communication media in the R community. Usually, two issues are published each year. This issue presents 10 interesting research articles especially introducing to new R

Dear All, The first issue of the third volume of The R Journal is now available at http://journal.r-project.org/current.html. Below are direct links to (most of) the articles: Volume 3/1, June 2011 Download complete issue Refereed articles may be downloaded individually using the links below. Table of Contents Editorial 3 Contributed Research Articles testthat:...

Yesterday, Hadley Wickham released his new package “devtools” at the CRAN repository. A great R package which supports the development process of R packages. R Packages are the fundamental unit of reproducible R code. The development of R packages is a complex topic and requires several additional tasks next to R programming. For example, you

As you can tell from the content on this blog, I am a really big fan of statistical analysis and the NHL. I haven’t blogged in some time simply because I have been deeply engrossed by the 2011 playoffs, where … Continue reading →

Let's define a new pattern!I do a lot of programming for research, and part of what this involves is turning calculations, usually expressed as verbs, into nouns. That is, I need to keep the calculation and all it's intermediate steps around so that I can inspect them.Alas, I am programming in Python most of the time and end up...