[R] Why does a custom function called is.numeric.factor break lattice?

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Nov 16 03:56:55 CET 2015


You need to read about S3 classes, and either make your custom function behave the way that function needs to behave or use a different function name for your custom function.

I think this is an example of the old saying that if it hurts when you slam your head against the wall, then don't do that.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On November 15, 2015 6:22:42 PM PST, sbihorel <Sebastien.Bihorel at cognigencorp.com> wrote:
>Hi,
>
>Pretty much everything is in the title of the post. An example is
>below.
>
>library(lattice)
>data <- 
>data.frame(x=rep(1:10,8),y=rnorm(80),trt=factor(rep(1:4,each=20)),groups=rep(1:8,each=10))
>xyplot <- xyplot(y~x|trt,data,groups=groups)
>
>is.numeric.factor <- function(){
>   print('hello world')
>}
>
>xyplot <- xyplot(y~x|trt,data,groups=groups)
>
>Thanks for shedding some light on this.
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list