Re: [R] Partial matching list elements in R 4.0

2020-05-28 Thread David Winsemius
There is a modifyList function in pkg utils that is used extensively in the code for lattice graphics:  var$options <- modifyList(var$options, list( misc=list(abc = "123"), mi= list(something    = 13))                                              ) #--- > var $options

Re: [R] Partial matching list elements in R 4.0

2020-05-27 Thread Bert Gunter
?identical ?rapply might also be useful to get more granular diagnostics. (??) Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, May 27, 2020 at 1:13 PM

Re: [R] Partial matching list elements in R 4.0

2020-05-27 Thread John Harrold
Awesome thanks. On Wed, May 27, 2020 at 1:31 PM William Dunlap wrote: > all.equal() > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Wed, May 27, 2020 at 1:13 PM John Harrold > wrote: > >> Thankyou Bert and Bill. >> >> I have one last question. Is there a tool that will

Re: [R] Partial matching list elements in R 4.0

2020-05-27 Thread William Dunlap via R-help
all.equal() Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, May 27, 2020 at 1:13 PM John Harrold wrote: > Thankyou Bert and Bill. > > I have one last question. Is there a tool that will recursively compare > two lists to find differences in both their structure and contents? > > I'm

Re: [R] Partial matching list elements in R 4.0

2020-05-27 Thread John Harrold
Thankyou Bert and Bill. I have one last question. Is there a tool that will recursively compare two lists to find differences in both their structure and contents? I'm afraid that in the process of converting code from $ to [[]] formats I may inadvertently introduce some errors. And I'd like to

Re: [R] Partial matching list elements in R 4.0

2020-05-26 Thread Bert Gunter
Hmmm... yes. I read (past tense) that passage as meaning that **when extracting** partial matching is only done with $. I did not read it as also saying that with assignment, partial matching with $ is not done, but I see how you could. As Bill D.'s example showed, even R seems confused about how

Re: [R] Partial matching list elements in R 4.0

2020-05-26 Thread John Harrold
Hello Bert, I've read the documentation and I didn't think it applied here. Perhaps it's my reading of that documentation I'm confused by. I stays *only when extracting*. What I'm doing here is assigning values. Is the expected behavior really to create a copy of the "misc" element in "mi" and

Re: [R] Partial matching list elements in R 4.0

2020-05-26 Thread William Dunlap via R-help
Another symptom of this problem is: > {x <- list(Abc=list(Pqr="Old Abc$Pqr")); x$Ab$Pqr <- "New Ab$Pqr" ; x} R version 3.6.2 (2019-12-12) | R version 4.0.0 (2020-04-24) List of 2| List of 2 $ Abc:List of 1 | $ Abc:List of 1 ..$ Pqr: chr "Old Abc$Pqr" | ..$

Re: [R] Partial matching list elements in R 4.0

2020-05-26 Thread Bert Gunter
I can't answer your question (about your R programming skills) but the behavior you complain about is as documented. In particular: "Thus the default behaviour is to use partial matching only when extracting from recursive objects (except environments) by $. Even in that case, warnings can be

[R] Partial matching list elements in R 4.0

2020-05-26 Thread John Harrold
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()) #