[R] by Function Result Factor Levels

Dario Strbenac dstr7320 at uni.sydney.edu.au
Wed Sep 16 04:00:12 CEST 2015

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

More information about the R-help mailing list