[R] use of names() within lapply()
smartpink111 at yahoo.com
Wed Apr 17 17:16:51 CEST 2013
----- Original Message -----
From: Ivan Alves <pap:
ucho at me.com>
To: "R-help at r-project.org" <R-help at r-project.org>
Sent: Wednesday, April 17, 2013 11:04 AM
Subject: [R] use of names() within lapply()
List g has 2 elements
 "2009-10-07" "2012-02-29"
and the list plot
lapply(g, plot, main=names(g))
results in equal plot titles with both list names, whereas distinct titles names(g) and names(g) are sought. Clearly, lapply is passing 'g' in stead of consecutively passing g and then g to process the additional 'main' argument to plot. help(lapply) is mute as to what to element-wise pass parameters. Any suggestion would be appreciated.
R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help