Elastic Sheep

Because elasticdog was already taken

Elastic Sheep header image 2

Discovering R

December 3rd, 2007 · No Comments · Uncategorized

I first encountered a mention of R some months ago, in a Zed Shaw rant about programmers and statistics. Sounded interesting but of no immediate use to me. Until last week.

I had some CPU load data to analyze. Plotting them as a time-series with Excel was easy enough but what my data would look like as an histogram ? How could I display the distribution of my samples over their range ? Too much for my Excel level !

Then I remembered about R. I asked Google, installed the package, skimmed the manual and within less than half-an-hour was able to display and analyze my data.

Let’s load the data from my CSV file :


"SAMPLE","LOAD"
"1",0.322
"2",0.246
"3",0.247
...

>data <- read.csv(“cpu.csv”,header=T)
>plot(data,ylim=c(0,1))
cpu_plot.png

Let’s plot the distribution of the LOAD column :


>hist(data$LOAD,xlim=c(0,1))

cpu_hist.png

To compute the statiscal properties of a series :


>summary(data$LOAD)


Min. 1st Qu. Median Mean 3rd Qu. Max.
0.2466 0.2804 0.2992 0.3015 0.3201 0.3710

Cherry on the pie, produced graphs can be as easily saved as PDF or JPG document.

R can be downloaded on The R-Project site.

Tags:

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment