[R] get names of list elements

Ista Zahn istazahn at gmail.com
Sat Oct 31 19:11:04 CET 2009


I don't think so. You can only get the name of something that has a
name, and in this case it does not.

-Ista

2009/10/31 Chirok Han <chirok.han at gmail.com>:
> Hi
>
> Consider
>> a <- 1:5; b <- 6:10
>> x <- list(a=a,b=b)
>> y <- list(a,b)
>
> I can get c("a","b") from x using names(x). Is it also possible to get
> "a" and "b" from y? (The command "names(y)" gives NULL.)
>
> Thanks in advance.
>
> Chirok
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org




More information about the R-help mailing list