R Under development (unstable) (2024-03-19 r86153 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. > > postscript("temp.ps") > library(lattice) > > > ## dotplot labels problem > > xx <- 1:10 > names(xx) <- rep(letters[1:5], 2) > dotplot(xx) > > > > > > > ## missing levels of factors > ## drop unused levels > > x <- 1:100 > y <- rnorm(100) > g <- gl(4, 25, 100) > > xyplot(y ~ x | g) > xyplot(y ~ x | g, subset = g != "2") > xyplot(y ~ x | g, subset = g != "2", + panel = function(x, y, subscripts) { + print(subscripts) + ltext(x, y, lab = subscripts) + }) [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [1] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [1] 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 [20] 95 96 97 98 99 100 > > > > ## subset & subscript interaction > > x <- rnorm(50) > y <- rnorm(50) > subset <- 20:40 > > xyplot(y ~ x, + panel = function(x, y, subscripts) { + print(subscripts) + ltext(x, y, lab = subscripts) + }) [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > > ## gives subscripts = 20:40 > xyplot(y ~ x, subset = subset, + panel = function(x, y, subscripts) { + print(subscripts) + ltext(x, y, lab = subscripts) + }) [1] 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > > g <- gl(2,1,50) > > xyplot(y ~ x, groups = g, panel = panel.superpose) > xyplot(y ~ x, groups = g, panel = panel.superpose, subset = subset) > > > > > > > > > ## reordering tests > > data(iris) > iris$foo <- equal.count(iris$Sepal.Length) > > foo <- xyplot(Petal.Length ~ Petal.Width | Species + foo, iris) > > foo > > foo$subset.cond <- list(1:3, 1:6) > foo$perm.cond <- 1:2 > foo > > foo$perm.cond <- 2:1 > foo$subset.cond <- list(c(1,2,3,1), 2:4) > foo > > > > bar <- xyplot(Petal.Length ~ Petal.Width | Species + foo, iris, skip = c(F, T)) > bar > > bar <- xyplot(Petal.Length ~ Petal.Width | Species + foo, iris, skip = c(F, T), scales = "free") > bar > > > > > > ## other stuff > > x <- numeric(0) > y <- numeric(0) > > bwplot(y ~ x) # fails? FIXME > > > x <- c(rnorm(10), rep(NA, 10)) > y <- gl(1, 20) > a <- gl(2, 10) > > bwplot(x ~ y | a) > > > ## warning: why ? > bwplot(x ~ y | a * a) > > > > > ## example from Wolfram Fischer > > > my.barley <- subset( barley, ! ( site == "Grand Rapids" & year == "1932" ) ) > > dotplot(variety ~ yield | year * site, my.barley, + layout=c(6,2), between=list(x=c(0,6))) > > > > dotplot(variety ~ yield | year * site, data = my.barley, + layout=c(6,2), + scales = + list(rot = 0, + y = + list(relation='sliced', + at = rep( list( FALSE, NULL ), 6 ))), + par.settings = + list(layout.widths = list(axis.panel = rep(c(1, 0), 3)))) > > > > > dev.off() null device 1 > > > > > proc.time() user system elapsed 3.17 0.14 3.28