Skip to content
Prev 307531 / 398506 Next

Summary using by() returns character arrays in a list

Thank you Petr,

Try this

str(by(iris, iris$Species, summary))

and you will see what is actually returned is a list of 3, each element
containing a character table, not a numeric table. The rownames of these
tables are empty but should contain the names of the summary stats.

I have a workaround now. Modified the summary.data.frame method to output
numeric values and not the character strings. The rownames I set
afterwards in a for loop. Still would like to know how to do this internal
to summary.data.frame though.

Regards,
Alex van der Spek