[Rd] Small request of a feature improvement in the next version of R

Paul Grosu pgrosu at gmail.com
Tue Nov 17 02:11:14 CET 2015


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.

Thank you,
Paul



More information about the R-devel mailing list