Created
November 20, 2015 21:05
-
-
Save milosgajdos/5b42db7b4197e6b13777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# split data per Species | |
species_frames <- split(iris,iris$Species) | |
# calculate mean per species | |
lapply(species_frames, function(x) colMeans(x[,"Sepal.Length"])) | |
# simple version of ^^ calculate mean over Sepal.Length split by Species | |
tapply(iris$Sepal.Length, iris$Species, mean) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment