[R] Partial matching list elements in R 4.0
John Harrold
john@m@h@rro|d @end|ng |rom gm@||@com
Tue May 26 17:59:03 CEST 2020
Hello,
I'm testing some code in R 4.0, and I'm having an issue with the following"
# -------------
rm(list=ls())
graphics.off()
#load("/tmp/post.RData")
var = list();
# If I uncomment this it fixes things:
# var$options = list(mi = list(),
# misc = list())
#
var$options$misc$abc = "123"
var$options$mi$something = 13
#------------
This is a stripped down example but it exhibits the issue I"m having.
Basically when I create the list element var$options$mi the contents of
var$options$misc move over to var$options$mi. And what was in
var$options$misc become NULL:
So now var$options looks like:
var$options
$misc
$misc$abc
NULL
$mi
$mi$abc
[1] "123"
$mi$something
[1] 13
This worked (still works) in R 3.5.1. I understand partial matching, but is
this normal lists moving over to elements like this? I can uncomment the
text mentioned in the example and it seems to fix it, but I'm wondering if
this is a bug or just my poor programming coming back to bite me.
I've included my sessionInfo() at the bottom.
Thanks
John
:wq
sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.5
Matrix products: default
BLAS:
/Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK:
/Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gdata_2.18.0 ggplot2_3.3.0 deSolve_1.28
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 gtools_3.8.2 withr_2.2.0 assertthat_0.2.1
[5] dplyr_0.8.5 digest_0.6.25 crayon_1.3.4 grid_4.0.0
[9] R6_2.4.1 lifecycle_0.2.0 gtable_0.3.0 magrittr_1.5
[13] scales_1.1.1 pillar_1.4.4 rlang_0.4.6 vctrs_0.3.0
[17] ellipsis_0.3.1 glue_1.4.1 purrr_0.3.4 munsell_0.5.0
[21] compiler_4.0.0 pkgconfig_2.0.3 colorspace_1.4-1 tidyselect_1.1.0
[25] tibble_3.0.1
[[alternative HTML version deleted]]
More information about the R-help
mailing list