R graph with two y-axes

February 4, 2008
By
R graph with two y-axes

I’ve been asked how to do this several times, so I thought it might help to put an example online. x <- 1:5 y1 <- rnorm(5) y2 <- rnorm(5,20) par(mar=c(5,4,4,5)+.1) plot(x,y1,type="l",col="red") par(new=TRUE) plot(x, y2,,t...

Read more »

Drop unused factor levels

February 4, 2008
By

When creating a subset of a dataframe, I often exclude rows based on the level of a factor. However, the "levels" of the factor remain intact. This is the intended behavior of R, but it can cause problems in some cases. I finally discovered how to clean up levels in this post to R-Help. Here is an example:>...

Read more »

Drop unused factor levels

February 4, 2008
By

When creating a subset of a dataframe, I often exclude rows based on the level of a factor. However, the "levels" of the factor remain intact. This is the intended behavior of R, but it can cause problems in some cases. I finally discovered how to clean up levels in this post to R-Help. Here is an example: >...

Read more »

R package: codetools

February 4, 2008
By

Since the release of R_2.6.0, R package developers were advised to use the ``codetools" package to check potential bugs. However, as I am not familiar with computer language, I found the warning messages a bit confusing. For example:> checkUsage(glm.fit): no visible binding for global variable ‘n’I don't understand what it really means. Apparently, `n' was not globally defined but...

Read more »

Paper on the Gillespie Stochastic Simulation Algorithm in press

February 1, 2008
By
Paper on the Gillespie Stochastic Simulation Algorithm in press

Just got news that my revisions to the reviewer’s comments on my paper GillespieSSA: Implementing the Gillespie Stochastic Simulation Algorithm in R were accepted. Hence, this paper is not officially in press in the Journal of Statistical Software. Here’s the … Continue reading →

Read more »

New material on the GGobi book web page

January 30, 2008
By

The GGobi book is now available from Springer and Amazon, after quite a delay. Getting the figures printed correctly was difficult. Solutions to the exercises in the back of each chapter are available for instructors by emailing Springer.The movies on ...

Read more »

New material on the GGobi book web page

January 30, 2008
By

The GGobi book is now available from Springer and Amazon, after quite a delay. Getting the figures printed correctly was difficult. Solutions to the exercises in the back of each chapter are available for instructors by emailing Springer.The movies on ...

Read more »

The hammer, or the sledgehammer? A small study in simulation

January 29, 2008
By

RKN over at Epidemiology blog had a small problem he solved using simulation:I have been interested in the following question: if there are, let's say, 5 genes involved in the liability of fx risk, and each gene has two alleles with one of them conferr...

Read more »

Shading overlapping area of curves in R

January 28, 2008
By

I was trying to plot figure in R like the one below, which is basically the veto player model of Tsebelis. Based on my knowledge of R now, I encountered 2 major problems:I don't know if there is a function that can draw archs, or at least partial curves from circles.I don't know if there is a good way...

Read more »

Heuristics for statistics

January 28, 2008
By
Heuristics for statistics

SIMPLE WAYS TO DETECT AND COMMUNICATE STATISTICAL EFFECTS Decision Science News is fond of heuristics and the Simonian view that for many problems organisms face, optimization is a fiction and satisficing makes us smart. Statistics is an area in which it is easy to see precision that isn’t there and find “optima” in problems that

Read more »

Hack-at-it 2007

January 28, 2008
By
Hack-at-it 2007

The GGobi Hack-at-it 2007 was held just before useR! 2007 in Ames Iowa.The main focus this year was on the data pipeline again, and on pipelines in other software.Several projects were discussed: the geometric shapes, high-dimensional games, local neig...

Read more »

Hack-at-it 2007

January 28, 2008
By
Hack-at-it 2007

The GGobi Hack-at-it 2007 was held just before useR! 2007 in Ames Iowa.The main focus this year was on the data pipeline again, and on pipelines in other software.Several projects were discussed: the geometric shapes, high-dimensional games, local neig...

Read more »

ERGMs in R

January 23, 2008
By
ERGMs in R

Developers of statnet, a collection of packages for R for fitting Exponential Random Graph Models (ERGM), issued a major update. First change is that the main package is now called ergm. Secondly, a set of additional packages has been made available. Apart from package network, that provides a class system for relational data on which

Read more »

Resources for S4 classes and methods

January 23, 2008
By
Resources for S4 classes and methods

Learning the programming in the new S4 system of classes and methods in R can be quite cumbersome, even though the methods package is very well documented. That is why I collected some of the info and materials that I am aware of on a separate page here. I warmly welcome any suggestions for extending

Read more »

GillespieSSA 0.5-1 is released

January 15, 2008
By
GillespieSSA 0.5-1 is released

I just uploaded GillespieSSA 0.5-1 to CRAN. Now it’s just a matter of days before it has propagated itself across all CRAN mirrors. This version consists primarily of revisions I made in response to the reviewer comments on the paper … Continue reading →

Read more »

Moving average/median

January 7, 2008
By

?rollmean (package=zoo)?rollmedian (package=zoo)?runmed (package=stats)

Read more »

Quantile regression in R

January 5, 2008
By
Quantile regression in R

Roger Koenker, a quantile regression crusader, has an R package that implements the procedure. It is called quantreg, and it is documented here. This package has apparently been around for quite some time, but I was only recently turned on to quantile ...

Read more »

Christmas presents…

December 21, 2007
By

Our Christmas tree has not been decorated yet, but the presents are there: the BMC Bioinformatics paper on userscripts in life sciences, Bioclipse 1.2.0, a long list of blogs to rate, and a very nice overview from Wendy Warr on workflow environments, d...

Read more »

A bugfix release for rjags

December 18, 2007
By
A bugfix release for rjags

Several people have written in to tell me that rjags crashes if you  re-run a modelling script in the same R session.  The crash is caused by a memory management bug in the JAGS library that is triggered when you … Continue reading →

Read more »

Rattle: an R GUI

December 16, 2007
By
Rattle: an R GUI

Rattle is a graphical interface to R. It supports basic data management tasks, as well as a number of different modeling functions. I haven’t had a chance to test it out yet since I don’t have my R installation  completely up to date, but it looks promising. For all of R’s strengths, one weakness is

Read more »

Convert factors to numbers

November 29, 2007
By

If you have a vector of factors it is easy to get the factor level; however, I always forget how to extract the factor value. I ran into the answer here.> x<-factor(c(round(rnorm(10),2),"A","B",NA))> x 1.61 1.12 1.26 0.09 -0.13 0.16 -0.03 -0.1 0.09 -0.47 A ...

Read more »

Convert factors to numbers

November 29, 2007
By

If you have a vector of factors it is easy to get the factor level; however, I always forget how to extract the factor value. I ran into the answer here. > x<-factor(c(round(rnorm(10),2),"A","B",NA))> x 1.61 1.12 1.26 0.09 -0.13 0.16 -0.03 -0.1 0.09 -0.47 A ...

Read more »

MetWare: metabolomics database project started on SourceForge

November 22, 2007
By

The Applied Bioinformatics at PRI group where I now work in Wageningen and the group of Steffen Neumann in Halle have started the MetWare project on Sourceforge to develop opensource databases for metabolomics data.The databases design will be based on...

Read more »

An R-based genetic algorithm

November 19, 2007
By

During my PhD I wrote a simple but effective genetic algorithm package for R. Because there was a bug recently found, and there is interest in extending the functionality, I have set up a SourceForge project called genalg.The package provides GA support for binary and real-value chromosomes (and integer chromosomes is something that will be...

Read more »

Preparing plots for publication

November 15, 2007
By

The plotting capabilities of R are excellent; however, when I am preparing a figure for publication, I often need to combine multiple plots or add objects (e.g., arrows or text) to an existing plot. While this can be accomplished in R, my patience for ...

Read more »

Preparing plots for publication

November 15, 2007
By

The plotting capabilities of R are excellent; however, when I am preparing a figure for publication, I often need to combine multiple plots or add objects (e.g., arrows or text) to an existing plot. While this can be accomplished in R, my patience for ...

Read more »

Linear panel data models in R: The PLM package

November 10, 2007
By
Linear panel data models in R: The PLM package

The plm package for R lets you run a number of common panel data models, including The fixed effects (or within) estimator The random effects GLS estimator It also allows for general GLS estimation, as well as GMM estimation, and includes a feature for heteroscedasticity consistent covariance estimation. It’s very easy to use, it simply

Read more »

Changing the fonts in R plots

October 28, 2007
By
Changing the fonts in R plots

Tweet I use R to do almost all of my statistical analysis and plotting. It has a very steep learning curve but once you get into it, it’s very powerful and you can customise almost anything. The only problem is that these changes are not...

Read more »

Quick-R: a great R tutorial site

October 23, 2007
By
Quick-R: a great R tutorial site

Quick-R, by Robert Kabacoff, is a wonderful R introduction site. It covers data management, basic and advanced statistics, and graphing in R, and it is aimed at an audience that has previous experience using other packages (such as SAS or Stata) that w...

Read more »