[R] Some kind of inverse of "names"

Bert Gunter gunter.berton at gene.com
Tue Aug 21 00:29:03 CEST 2012


Inline

-- Bert

On Mon, Aug 20, 2012 at 3:19 PM, Julio Sergio Santana
<juliosergio at gmail.com> wrote:
> I wonder if there exists some kind of inverse of the "names" primitive in
> R. Let me explain what do I mean:
>
> If I create a list:
>   -> li <- list(a=1, b=2, c=3, d=4)
> then I can have:
>   -> names(li)
>   [1] "a" "b" "c" "d"
> which is, I guess, some kind of vector, since
>   -> typeof(names(li))
>   [1] "character"
> however, I haven't seen something that allows me to get the other side,
> i.e., the values.
> Something like:
>   ->VALUES(li)
>   [1] 1 2 3 4
>
> Do you have any comments on this?

Yes. Read "An Introduction to R" . You do not understand lists. Also see ?unlist

-- Bert

>
>
> Thanks,
>   - Sergio.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list