search for: getfreq

Displaying 1 result from an estimated 1 matches for "getfreq".

Did you mean: getfrem
2006 Feb 18
1
reshaping result of by()
...s including the latter: ---<---------------cut here---------------start-------------->--- toydf <- expand.grid(sample(0:50, 50, TRUE), c("A", "B"), c("pop1", "pop2", "pop3", "pop4", "pop5")) "getFreq" <- function(x, bks) { fhist <- hist(x, breaks = bks, plot = FALSE, include.lowest = TRUE) matrix(c(fhist$breaks[-1], fhist$counts), nrow = length(fhist$breaks[-1]), ncol = 2) } freqs <- by(toydf[[1]], list(toydf[[2]], toydf[[3]]), getFreq, bks = 0:50)...