I have J Chambers wonderful text ( Software for data Analysis) and I've been trying my hand at some very routine S4 OOP development.
One of the things I was trying to do was to create some very basic S4 classes. The first was simply a class that had a data.frame as part of its representation. setClass("df",representation(dirframe="data.frame")) The object basically contains a data.frame that represents a file directory listing with a column named filename, size, time, etc. And then I have methods for doing various things with this object. I then tried to tackle the problem of coercing this S4 object to a data.frame. Again just a learning exercise. The goal would be able to make a call like this testFrame <- as.data.frame(x) where x, was an object of class "df" If I try to define "as.data.frame" as a S4 method, then I can make it work, but I then destroy the S3 functionality of as.data.frame, so that if I were to try to coerce a matrix to a data.frame it would work. So, I guess my question is what do I do, write an s3 method for as.data.frame that takes a "df" object as a paramter? The book wasn't exactly clear ( or I'm not that bright), or is there a way to make the S4 method I wrote "as.data.frame" call the S3 method if needed? [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.