Global Sea Surface Temperature Trends (1850-2009)

September 4, 2009
By
Global Sea Surface Temperature Trends (1850-2009)

In this post, I show an R script that downloads the Hadley Centre’s 1850-2009 monthly sea surface temperature (HadSST2) anomaly data, converts the ASCII file into 2 usable R data frames, calculates overall and post 1980 SST anomaly trend rates and develops a 2 panel chart that shows SST anomalies and trend rates and the

Read more »

R Flashmob #2

September 4, 2009
By
R Flashmob #2

As I said before, I consider the R-Help mailing list an invaluable source of information if you want to get things done in R. Recently the stackoverflow website, a site where programmers can post and answer questions about a wide list of programming la...

Read more »

Compiling and Cross-compiling R packages for Windows (win32)

September 3, 2009
By

so recently i’m learning how to compile and cross-compile R packages from source for windows machines, which means i have to create windows binaries. the first option is to build on a windows system, and the 2nd is to cross-build on an intel-based linux or mac system. i will outline my experience. Send it off

Read more »

Let’s All Go Down to the Barplot!

September 3, 2009
By
Let’s All Go Down to the Barplot!

I’m back for another pean to ANOVA-loving experimental ecology. Barplots (or point-range plots – but which is better is a discussion for a different time) are the thing! And a friend of mine was recently asking me how to do a decent barplot with ggplot2 for data of moderate complexity (e.g., a 2-way ANOVA). So

Read more »

Truncated Normal Distribution

September 3, 2009
By

Many distributions may be used to describe patterns that are non-negative; however, there are not as many choices when an upper bound is also needed (although the beta distribution is very flexible). For various reasons, truncated distributions are som...

Read more »

Truncated Normal Distribution

September 3, 2009
By

Many distributions may be used to describe patterns that are non-negative; however, there are not as many choices when an upper bound is also needed (although the beta distribution is very flexible). For various reasons, truncated distributions are som...

Read more »

update on the ant package

September 3, 2009
By

I have updated the ant package I described yesterday in this blog to add several things Now the R code related to <r-set> and <r-run> tasks can either be given as the code attribute or as the text inside the task The R code has acces...

Read more »

Learning ggplot2: 2D plot with histograms for each dimension

September 3, 2009
By
Learning ggplot2: 2D plot with histograms for each dimension

Update (April 2013): The code below doesn't work anymore with new ggplot2 versions, here is an updated version.I have two 2D distributions and want to show on a 2D plot how they are related, but I also want to show the histograms (actually, density plots in this case) for each dimension. Thanks to ggplot2 and a

Read more »

Learning ggplot2: 2D plot with histograms for each dimension

September 3, 2009
By
Learning ggplot2: 2D plot with histograms for each dimension

I have two 2D distributions and want to show on a 2D plot how they are related, but I also want to show the histograms (actually, density plots in this case) for each dimension. Thanks to ggplot2 and a Learning R post, I have sort of managed to do what I want to have:

Read more »

Fitting lactation curves/functions in R

September 3, 2009
By

It is quite some time ago since I wrote a set of lactation curves/functions in R. I put those functions in the animSci package. However, the package is in a mess for quite some time now - I was adding some new functions, but did not have time to finish the job properly. This is also the reason...

Read more »

Fitting lactation curves/functions in R

September 3, 2009
By

It is quite some time ago since I wrote a set of lactation curves/functions in R. I put those functions in the animSci package. However, the package is in a mess for quite some time now - I was adding some new functions, but did not have time to finish the job properly. This is also the reason...

Read more »

R capable version of ant

September 2, 2009
By

ant is an amazing build tool. I have been using ant for some time to build the java code that lives inside the src directories of my R packages, see this post for example. The drawbacks of this approach are : that it assumes ant is available on...

Read more »

Tip: get java home from R with rJava

September 2, 2009
By

Assuming rJava is installed and works, it is possible to take advantage of its magic to get the path where java is installed: $ Rscript --default-packages="methods,rJava" -e ".jinit(); .jcall( 'java/lang/System', 'S', 'getProperty', 'java.home' )...

Read more »

Analysis of Variance

September 1, 2009
By
Analysis of Variance

In an experiment study, various treatments are applied to test subjects and the response data is gathered for analysis. A critical tool for carrying out the analysis is the Analysis of Variance (ANOVA). It enables a researcher to differentiate treatm...

Read more »

Analysis of Variance

September 1, 2009
By
Analysis of Variance

In an experiment study, various treatments are applied to test subjects and the response data is gathered for analysis. A critical tool for carrying out the analysis is the Analysis of Variance (ANOVA). It enables a researcher to differentiate treatm...

Read more »

Example 7.11: Plot an empirical cumulative distribution function from scratch

August 31, 2009
By
Example 7.11: Plot an empirical cumulative distribution function from scratch

In example 7.8, we used built-in functions to produce an empirical CDF plot. But the empirical cumulative distribution function (CDF) is simple to calculate directly, and it might be useful to have more control over its appearance than is afforded by...

Read more »

CO2 and Temperature Trends

August 31, 2009
By
CO2 and Temperature Trends

In a previous post I discussed problems with an Excel based CO2 and temperature trend chart that used 2 Y axes. Double axis charts can be misleading because they may distort the Y axis for one of the series. In this post I show another example of am ineffective double Y axis CO2 and temperature

Read more »

Formatting Decimals in Texts with R

August 30, 2009
By
Formatting Decimals in Texts with R

anping Chen raised a question in the Chinese COS forum on the output of Eviews: how to (re)format the decimal coefficients in equations as text output? For example, we want to round the numbers in CC = 16.5547557654 + 0.0173022117998*PP + 0.216234040485 * PP(-1) + 0.810182697599 * (WP + WG) to the 3rd decimal places.

Read more »

Counterintuitive Results in Flipping Coins

August 28, 2009
By
Counterintuitive Results in Flipping Coins

oin-flipping is a rather old topic in probability theory, so most of us think we know very well about it, however, the other day I saw a question about this old topic (in David Smith’s REvolution?) which was beyond me expectation: how many times do we need to flip the coin until we get a

Read more »

‘R’ programming

August 28, 2009
By
‘R’ programming

http://en.wikibooks.org/wiki/R_Programming

Read more »

Learning R 2009-08-28 13:11:00

August 28, 2009
By
Learning R 2009-08-28 13:11:00

fydeficit.1projectedpng("c:/data/deficit_color.png",height=480,width=480)plot(deficit.1~fy,ylim=c(-12,5),type="n",lwd=2,col="red",main="Federal budget deficit, 1990-2019",cex.lab=1.1,cex.axis=.75,xlab="Fiscal year",ylab="Deficit (% of GDP)")rect(1988,-15,1994,6,col="#FF9999",border=NA)rect(1994,-15,2002,6,col="#6699FF",border=NA)rect(2002,-15,2010,6,col="#FF9999",border=NA)rect(2010,-15,2014,6,col="#6699FF",border=NA)rect(2014,-15,2021,6,col="#CCCCCC",border=NA)abline(h=0,lwd=.5,lty=3,col="#555555")lines(fy,deficit.1,lwd=2.5)lines(fy,projected,lwd=2.5,lty=2)rect(1990,-11.5,2000,-9.5,col="#dddddd",border="#555555")text(1995,-10.5,"Source: CBO")graphics.off()

Read more »

Learning R 2009-08-28 13:11:00

August 28, 2009
By
Learning R 2009-08-28 13:11:00

fydeficit.1projectedpng("c:/data/deficit_color.png",height=480,width=480)plot(deficit.1~fy,ylim=c(-12,5),type="n",lwd=2,col="red",main="Federal budget deficit, 1990-2019",cex.lab=1.1,cex.axis=.75,xlab="Fiscal year",ylab="Deficit (% of GDP)")rect(1988,-15,1994,6,col="#FF9999",border=NA)rect(1994,-15,2002,6,col="#6699FF",border=NA)rect(2002,-15,2010,6,col="#FF9999",border=NA)rect(2010,-15,2014,6,col="#6699FF",border=NA)rect(2014,-15,2021,6,col="#CCCCCC",border=NA)abline(h=0,lwd=.5,lty=3,col="#555555")lines(fy,deficit.1,lwd=2.5)lines(fy,projected,lwd=2.5,lty=2)rect(1990,-11.5,2000,-9.5,col="#dddddd",border="#555555")text(1995,-10.5,"Source: CBO")graphics.off()

Read more »

Combine R CMD build and junit

August 28, 2009
By

This is a post in the series Mixing R CMD build and ant. Previous posts have shown how to compile the java code that lives in the src directory of a package and how to document this code using javadoc. This post tackles the problem of unit testin...

Read more »

A Fast Intro to PLYR for R

August 27, 2009
By
A Fast Intro to PLYR for R

I’m not dead yet! Although it has been rumored that I am. The new job is going great and I’m thrilled to be with a new firm doing interesting work alongside smart people. It makes me seem smarter by simple association. There’s been a lot going on recently in the R user community. There was an

Read more »

Using R and Bioconductor for sequence analysis

August 26, 2009
By
Using R and Bioconductor for sequence analysis

Here's another quick R vignette, in case I pick this up later and need to remind myself where I got stuck. I was trying to use R for a bit of basic sequence analysis, with mixed results.First, install the BSgenome package, which is part of Bioconductor...

Read more »

ggplot2 Version of Figures in “Lattice: Multivariate Data Visualization with R” (Final Part)

August 25, 2009
By
ggplot2 Version of Figures in “Lattice: Multivariate Data Visualization with R” (Final Part)

Over the past weeks I have tried to replicate the figures in Lattice: Multivariate Data Visualization with R using Hadley Wickham’s ggplot2. With the exception of a few graph types (e.g. ggplot2 doesn’t support 3d-graphs, and there were a few other cases), it was possible to create ggplot2 versions of almost all the figures. Sometimes this

Read more »

Web-site trend analysis with data from Google Analytics

August 25, 2009
By
Web-site trend analysis with data from Google Analytics

This post is a summary of my two previous posts on the trend analysis with the Cox-Stuart test and on simple linear regression. The goal that we propose is to assess the trend in the number of visits received from a site over a long time. I use Google Analytics, because this tool allows us to save...

Read more »

Web-site trend analysis with data from Google Analytics

August 25, 2009
By
Web-site trend analysis with data from Google Analytics

This post is a summary of my two previous posts on the trend analysis with the Cox-Stuart test and on simple linear regression. The goal that we propose is to assess the trend in the number of visits received from a site over a long time. I use Google Analytics, because this tool allows us to save...

Read more »

Applied Spatial Data Analysis with R

August 25, 2009
By
Applied Spatial Data Analysis with R

I have just reviewed the book Applied Spatial Data Analysis with R which has been published in the September2009  issue of the Royal Statistical Society’s Significance magazine. Applied Spatial Data Analysis with R is an accessible text that demonstrates and explains the handling of spatial data using the R Software Platform. The text’s authors have

Read more »