[R] Get object name inside lapply

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Feb 25 23:25:43 CET 2016



On 25.02.2016 22:27, Mohammad Tanvir Ahamed via R-help 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)
> $a
> NULL
>
> $b
> NULL
>
> Why NULL ?

Why should it? seq(1:5) has no names, nor has seq(10:20).

Best,
Uwe Ligges





>
> 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
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list