Share

Means and Standard Errors the Easy Way

The attached ZIP file contains commented code that allows R users to output means and standard errors of their data based on factors and their combinations, with just a few edits for the specifics of their data set. This version tolerates missing values and calculates standard error based on actual counts of factor combination replications. The file includes an example data set and is parameterized for that data set so one can see what needs to be changed for their own.

This output is convenient for passing to a graphing script that requires means and standard errors.

For example, if you have 4 reps of a facotrial design with two levels of phosphorus and two genotypes (HP, LP, GenotypeA, GenotypeB) then the code will automatically determine mean and standard error for all their combinations HP-GenotypeA, LP-GenotypeA, HP-GenotypeB, LP-GenotypeB.  It can handle as many factors as you like.

Created by Larry York on 2/17-2012