# Posts Tagged ‘ for loop ’

## Outer Product of Character Vectors in R

July 19, 2012
By

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 ...

## weird [lack of] control…

February 20, 2012
By

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 the for loop is robust

## Use of Classification Trees to Investigate Traits of Invasive Species

September 20, 2011
By

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
By

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
By

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
By

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
By

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 »

## Multivariate Repeated Measurements With adonis():

April 18, 2011
By

Lately I had to figure out how to do a repeated measures (or mixed effects) analysis on multivariate (species) data. Here I share code for a computation in R with the adonis function of the vegan package. Credit goes to Gavin Simpson providing most of ...