[Rd] S4 objects in formulas

From: David L Lorenz <lorenz_at_usgs.gov>
Date: Mon, 23 Jul 2012 15:33:35 -0500

Hi,
  I have very carefully developed several S4 classes that describe censored water-quality data. I have routines for them that will support their use in data.frames and so forth. I have run into a problem when I try to use the S4 class as the response variable in a formula and try to extract the model frame. I get an error like:

Error in model.frame.default(as.lcens(Y) ~ X) : object is not a matrix

  In this case, as.lcens works much like the Surv function in the survival package except that the object is an S4 class and not a matrix of class Surv. I would have expected that the model.frame function would have been able to manipulate any kind of object that can be subsetted and put into a data.frame. But that appears not to be the case. I'm using R 2.14.1 if that matters.
  I can supply the routines for the lcens data if needed.   Am I looking at needing to write a wrapper to convert all of my S4 classes into matrices and then extract the necessary data in the matrices according to rules for the particular kind of S4 class? Or, am I missing a key piece on how model.frame works?
  Thanks.
Dave

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 23 Jul 2012 - 20:37:03 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jul 2012 - 06:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive