Dear list-members,
I find a annoying difference between R 3.1.3 and R 3.2.

To get the element name of a list within lapply() or mclapply() call, I used the trick below:
For example:

essai <- list(T2345=c(5, 6, 7), T5664=c(9, 12, 17, 16))
lapply(essai, function(x) plot(x, main= names(essai)[substitute(x)[[3]]]))

It works fins in R 3.1.3 however in R 3.2 it produces an error:
> essai <- list(T2345=c(5, 6, 7), T5664=c(9, 12, 17, 16))
> lapply(essai, function(x) plot(x, main= names(essai)[substitute(x)[[3]]]))

 Error in names(essai)[substitute(x)[[3]]] :
  type 'symbol' d'indice incorrect

I don't see if this difference is noted is the list of changes:
http://cran.r-project.org/doc/manuals/r-devel/NEWS.html

If it is not a bug but a feature, what is the new way to get the list element name within a lapply or mclappy function.

Thanks a lot

Marc Girondot

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to