I am trying to calculate quantiles of a data frame column split up by two factors: # Calculate the quantiles quarts = tapply(gdf$tt, list(gdf$Runway, gdf$OnHour), FUN=quantile, na.rm = TRUE) This does not work: > quarts 04L 04R 15R 22L 22R 27 32 33L 33R 0 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL 1 NULL Numeric,5 NULL Numeric,5 NULL NULL NULL Numeric,5 NULL 2 NULL NULL NULL Numeric,5 NULL NULL NULL NULL NULL 3 NULL NULL NULL NULL NULL NULL NULL Numeric,5 NULL 4 NULL NULL NULL NULL NULL NULL NULL NULL NULL 5 NULL NULL NULL NULL NULL NULL NULL NULL NULL 6 NULL NULL NULL NULL NULL NULL NULL NULL NULL 7 NULL Numeric,5 NULL NULL NULL Numeric,5 NULL Numeric,5 NULL 8 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL . . .
But if I leave out either of the two factors, it does work > quarts = tapply(gdf$tt, list(gdf$Runway), FUN=quantile, na.rm = TRUE) > quarts $`04L` 0% 25% 50% 75% 100% 4 8 9 10 20 $`04R` 0% 25% 50% 75% 100% 0 9 10 11 28 . . . . How can I get this to work? Thanks, Jim Rome ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.