Skip to content
Prev 18036 / 63424 Next

extending lattice to S4 classes

ernesto wrote:

            
Hi,

I found an hack (see below) to make it work but it's terrible and hugly
... some suggestions are welcome. It simply tests if data belongs to
class "FLQuant" and transforms it into a data.frame before ploting.

Regards

EJ

if (!isGeneric("xyplot")) {
    setGeneric("xyplot", useAsDefault = xyplot)
}


setMethod("xyplot", signature("formula"), function(x, ...){

    dots <- list(...)
    if(class(dots$data)=="FLQuant") dots$data <- as.data.frame(dots$data)
    call.list <- c(x = x, dots)
   
# needed this to avoid an infinite loop because xyplot is defined only
for "x"
    xyplot <- lattice::xyplot   
    ans <- do.call("xyplot", call.list)
    ans$call <- match.call()
    ans

})