R Under development (unstable) (2025-09-08 r88798 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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. > ## Tests for non-standard evaluation in layer() > > library(lattice) > library(latticeExtra) > oopt <- lattice.options(panel.error = NULL) > > xx <- 1970 > xyplot(nhtemp) + layer(panel.abline(v = xx)) > > layer.test1 <- function() { + xyplot(nhtemp) + layer(panel.abline(v = xx)) + } > layer.test1() > > layer.test2 <- function() { + vline <- 1920 + xyplot(nhtemp) + layer(panel.abline(v = vline)) + } > try(plot(layer.test2()), silent = TRUE) # fails > > layer.test3 <- function() { + zz <- 1930 + ls.str(environment()) + xyplot(nhtemp) + layer(panel.abline(v = vline), + data = list(vline = zz)) + } > layer.test3() > > layer.test4 <- function() { + zz <- 1940 + xyplot(nhtemp) + layer(panel.abline(v = c(zz, xx)), + data = environment()) + } > layer.test4() > > do.call(lattice.options, oopt) > > > > > proc.time() user system elapsed 0.39 0.09 0.46