[R] confusion about dev.prev()

Peter Langfelder peter@|@ng|e|der @end|ng |rom gm@||@com
Mon Dec 5 14:28:16 CET 2022


Hi all,

I'm either confused about dev.prev() or there's a bug in it. Open two
devices, plot a plot, call dev.prev() and plot again. I would expect
the second plot to appear in the first device, but that is not what
happens; both plots appear in the second device. Is this expected
behavior or a bug?
Example (in linux):

x11()
par(mfrow = c(1,2));
x11()
par(mfrow = c(1,2));
plot(1:10)
dev.prev()
plot(10:20)

This happens both in R-4.2.0 (patched) and R-devel from 2022-09-13
(sorry, don't have a newer one handy).

sessionInfo() from the R-devel session:

R Under development (unstable) (2022-09-13 r82849)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Fedora Linux 36 (Thirty Six)

Matrix products: default
BLAS:   /usr/local/lib64/R-devel/lib/libRblas.so
LAPACK: /usr/local/lib64/R-devel/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.3.0



More information about the R-help mailing list