for loop

Outer Product of Character Vectors in R

July 19, 2012 |

What follows is like a kata to strengthen your R fundamentals. The lovely stats in the wild recently posted some hott data analysis of Olympians’ ages and sexes. Because I’m annoyingly picky about graphics, I asked for his code so I could ... [Read more...]

weird [lack of] control…

February 20, 2012 |

When I ran I was expecting the same output as So this means that the dummy index in R “for” loops cannot be tweaked that easily. I seem to remember doing this kind of (dirty) tricks with earlier versions… Now, Alessandra and Robin think this is a good thing that ... [Read more...]

Use of Classification Trees to Investigate Traits of Invasive Species

September 20, 2011 |

Which traits make an alien species invasive?Due to what traits an alien species becomes established in a foreign flora?This kind of questions could be analysed by the use of recursive partitioning and classification trees..(the below example also inclu...

Summarize Data by Several Variables

May 23, 2011 |

Here's an example how to conveniently summarize data with the cast function (package reshape). By the way you see how this could be done "in-conveniently" by hand. You also see how a for-loop works and how a matrix is constructed and fill...

Bootstrap Confidence Intervals for Diversity Indices

April 30, 2011 |

Here's the bootstrap refinement of the normal asymptotic interval (Mills and Zandvakili, 1997; Dixon et al., 1987; Efron and Tibshirani, 1997) - where Diversity (div, g) is the Simpson Index calculated from the observed sample, k is the number boot...

Bootsrap Confidence Intervals, Stratified Bootstrap

April 20, 2011 |

Here's a worked example for comparing group averages with bootstrap confidence intervals and allowing for different subsample sizes by calling the strata argument within the bootstrap function.The data is set up analogous to an before-after impac...

Test Difference Between Diversity-Indices of Two Samples with Abundance Data

April 18, 2011 |

I adapted a scheme for a permutation test from the PAST Software (Hammer & Harper, http://folk.uio.no/ohammer/past/diversity.html) that tests difference between diversity-indices of two samples with abundance data... Read more »