R Under development (unstable) (2024-01-23 r85822 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(directlabels) > if(require(lattice) && require(nlme)){ + data(BodyWeight, package="nlme") + oldopt <- lattice.options(panel.error=NULL) + p <- xyplot(weight~Time|Diet,BodyWeight,groups=Rat,type='l', + layout=c(3,1),xlim=c(-10,75)) + stop.if.same.colour <- function(d, ...){ + col.tab <- table(d$colour) + if(1 == length(col.tab)){ + print(d) + stop("only one colour") + } + d + } + dl <- direct.label(p, list("angled.boxes", "stop.if.same.colour")) + print(dl) + lattice.options(oldopt) + } Loading required package: lattice Loading required package: nlme Attaching package: 'nlme' The following object is masked from 'package:directlabels': gapply > > proc.time() user system elapsed 0.53 0.12 0.64