Re: [Rd] Small request of a feature improvement in the next version of R
On Mon, 2015-11-16 at 20:11 -0500, Paul Grosu wrote: > Hi Everyone, > > Sorry to bother the list with this small request, but I've run into this > issue and was wondering if it could be fixed in the next version of R. > Sorry if it was raised in a previous thread: > > So when I try the following I get an error: > > > m <- list() > > m[["A3V6HVSALQ835D"]][['profiles']] <- 3 > > m[["A3V6HVSALQ835D"]][['stars']] <- c(1, 23) > Error in m[["A3V6HVSALQ835D"]][["stars"]] <- c(1, 23) : > more elements supplied than there are to replace > > As does the following: > > > m <- list() > > m[["A3V6HVSALQ835D"]][['profiles']] <- c() > > m[["A3V6HVSALQ835D"]][['stars']] <- c() > > m[["A3V6HVSALQ835D"]][['profiles']] <- 3 > > m[["A3V6HVSALQ835D"]][['stars']] <- c(1, 23) > Error in m[["A3V6HVSALQ835D"]][["stars"]] <- c(1, 23) : > more elements supplied than there are to replace > > But when I reverse the order, I don't: > > > m <- list() > > m[["A3V6HVSALQ835D"]][['stars']] <- c(1, 23) > > m[["A3V6HVSALQ835D"]][['profiles']] <- 3 > > As doesn't the following, with the order reversed for the assignment: > > > m <- list() > > m[["A3V6HVSALQ835D"]][['profiles']] <- c() > > m[["A3V6HVSALQ835D"]][['stars']] <- c() > > m[["A3V6HVSALQ835D"]][['stars']] <- c(1, 23) > > m[["A3V6HVSALQ835D"]][['profiles']] <- 3 > > And when I instantiate it in this way, it does not with the original order: > > > m <- list() > > m[["A3V6HVSALQ835D"]][['profiles']] <- c() > > m[["A3V6HVSALQ835D"]][['stars']] <- list() > > m[["A3V6HVSALQ835D"]][['profiles']] <- 3 > > m[["A3V6HVSALQ835D"]][['stars']] <- c(1, 23) > > The request is so that order-specific assignments would not throw an error, > and I am using version 3.2.2 of R. Your example combines two nested calls to the replacement function "[[<-". It is a lot easier to understand what is going wrong if you break this down into two separate function calls. First, the element of m that you want to modify is NULL: > m <- list() > m[["A3V"]] NULL So the expression > m[["A3V"]][['profile']] <- 3 is equivalent to: > tmp <- NULL > tmp[['profile']] <- 3 > m[["A3V"]] <- tmp Inspecting the result: > m $A3V profile 3 > class(m$A3V) [1] "numeric" So m$A3V is a numeric vector and not, as you expected, a list. This behaviour of "[[<-" when applied to NULL objects is documented on the help page: See help("[[<-") The solution is to create m[["A3V"]] as a list before modifying its elements: > m <- list() > m[["A3V"]] <- list() ... Martyn > Thank you, > Paul > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel --- This message and its attachments are strictly confidenti...{{dropped:8}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Small request.
As of a few weeks ago, rtools does store the current version in the registry but its only a gross figure such as 2.7 or 2.8 and that would not be enough to identify the build. On Tue, May 27, 2008 at 4:45 PM, [EMAIL PROTECTED] wrote: This is (hopefully) a small request. I routinely build (and test) both R versions from sources on my system (WinXP). I would like to be sure that I have the current version of Rtools. I always go to Robert Murdoch's site Building R for Windows and check the latest news. Everything I need is explained there, except I never know if I have the most recent version of Rtools.exe. I see Rtools28.exe but my understanding is that this file is refreshed quite frequently. Is so, would it be possible to include some version numbering scheme in its name? Perhaps a build date stamp can be included instead? Thanks in advance, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Small request.
Sorry for the mix-up with Robert Murdoch. I do not know what I was thinking. I just wanted to clarify what would be useful to me. If possible, I would like to have some kind of indication on the website what version of Rtools28 (or some future Rtools) is the most current. This way, I would know whether I needed to download and install it. I do not care much what it writes into registry. Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 Gabor Grothendieck [EMAIL PROTECTED] To ail.com [EMAIL PROTECTED] Sent by: cc [EMAIL PROTECTED] r-devel@r-project.org -project.org Subject Re: [Rd] Small request. 05/27/2008 04:38 PM As of a few weeks ago, rtools does store the current version in the registry but its only a gross figure such as 2.7 or 2.8 and that would not be enough to identify the build. On Tue, May 27, 2008 at 4:45 PM, [EMAIL PROTECTED] wrote: This is (hopefully) a small request. I routinely build (and test) both R versions from sources on my system (WinXP). I would like to be sure that I have the current version of Rtools. I always go to Robert Murdoch's site Building R for Windows and check the latest news. Everything I need is explained there, except I never know if I have the most recent version of Rtools.exe. I see Rtools28.exe but my understanding is that this file is refreshed quite frequently. Is so, would it be possible to include some version numbering scheme in its name? Perhaps a build date stamp can be included instead? Thanks in advance, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel