[R] Get object name inside lapply
Sarah Goslee
sarah.goslee at gmail.com
Thu Feb 25 22:45:11 CET 2016
Posting in HTML makes it much harder for people to figure out your code.
Maybe this will help:
> c<-list(a=seq(1:5),b=seq(10:20))
> c[[1]]
[1] 1 2 3 4 5
> c[[2]]
[1] 1 2 3 4 5 6 7 8 9 10 11
> names(c[[1]])
NULL
> names(c[[2]])
NULL
On Thu, Feb 25, 2016 at 4:15 PM, Mohammad Tanvir Ahamed via R-help
<r-help at r-project.org> wrote:
> Hello,
> I want to get object name of a list inside lapply
>> c<-list(a=seq(1:5),b=seq(10:20))> lapply(c,names)$aNULL
> $bNULL
> Why NULL ?
> but i am expecting the names of object . Any help will be appreciated .
> I want to grab the names of object inside lapply for further process.
> Thanks .
>
> Tanvir Ahamed
> Göteborg, Sweden | mashranga at yahoo.com
> [[alternative HTML version deleted]]
>
More information about the R-help
mailing list