[Rd] S4 objects in data frames?

Byron Ellis byron.ellis at gmail.com
Thu Sep 20 06:59:46 CEST 2007


Is there any way to get S4 objects into a data frame and have the
resulting data frame actually be printable?

After a good deal of work I managed to convert an S4 objects that
holds several other objects into a data.frame object using a custom
as.data.frame method, but I have been unable to discover how to make
the result data.frame printable.

I've tried making format() generic, no dice. It eventually just
wanders down the path to filter.default, which then tries to
(incorrectly) unlist the contained S4 object. Obviously this doesn't
work.

I can make a matrix of these objects without much trouble (there isn't
a reasonable print function there either, but at least it doesn't
error out).

Any clues? Someone who's managed to pull it off? I'm ready to do
something horrible like create a wrapper class that extends character
just to get it to work right, but this will be annoying for other
reasons.

-- 
Byron Ellis (byron.ellis at gmail.com)
"Oook" -- The Librarian



More information about the R-devel mailing list