Do you want something like the following? > library(dplyr, quietly=TRUE, warn.conflicts=FALSE) > warpbreaks %>% group_by(wool, tension) %>% summarize(Min=min(breaks), > Median=median(breaks), Max=max(breaks)) Source: local data frame [6 x 5] Groups: wool
wool tension Min Median Max 1 A L 25 51 70 2 A M 12 21 36 3 A H 10 24 43 4 B L 14 29 44 5 B M 16 28 42 6 B H 13 17 28 Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Sep 15, 2015 at 7:00 PM, Dario Strbenac <[email protected]> wrote: > Good day, > > How is it possible to get a data.frame of factor levels used for obtaining > each element of the result of the by function ? For example, > > result <- by(warpbreaks[, 1], warpbreaks[, -1], summary) >> result > wool: A > tension: L > Min. 1st Qu. Median Mean 3rd Qu. Max. > 25.00 26.00 51.00 44.56 54.00 70.00 > ... > > I'd like to obtain a data.frame of the two columns, wool and tension, > specifying the level of each factor that corresponds to each element of > result. > > -------------------------------------- > Dario Strbenac > PhD Student > University of Sydney > Camperdown NSW 2050 > Australia > > ______________________________________________ > [email protected] mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ [email protected] mailing list -- To UNSUBSCRIBE and more, see 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.

