[R] List Name help

Linlin Yan yanlinlin82 at gmail.com
Tue Nov 24 07:39:56 CET 2009


On Tue, Nov 24, 2009 at 1:01 AM, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
> Try this:
>
> test[grep("d2", names(test))]
>
Or it can be simply like this:

test[names(test) == "d2"]

> On Mon, Nov 23, 2009 at 2:53 PM, Rajasekaramya <ramya.victory at gmail.com> wrote:
>>
>> Hi There,
>>
>> I have a named List object.I want to access all the list elements that has
>> the same name
>> for example
>> The List
>> test <- list()
>> $d2
>> v1 v2 v3 v4
>> 1 2 3 4 5
>>
>> $d2
>> v1 v2 v3 v4
>> 1 2 3 4 5
>>
>> $d3
>> v1 v2 v3 v4
>> 8 9 19 10
>>
>> $d1
>> v1 v2 v3 v4
>> 12 14 15 16
>>
>> so if i say test[["d2"]] or test["d2"] i should get the first two that
>> matches the name rite but i am not getting them jus getting the first one.
>>
>> Any suggestions on it
>>
>> Ramya
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://old.nabble.com/List-Name-help-tp26481873p26481873.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list