Skip to content
Prev 139330 / 398506 Next

subset list based on logical within element flag

Hi I have the smililar question.

I have a list:
my_list <- list(name="Fred", wife="Mary",
no.children=3, child.ages=c(4,7,9))
$name
[1] "Fred"

$wife
[1] "Mary"

$no.children
[1] 3

$child.ages
[1] 4 7 9


Now I want to search "Fred" and get attribute of that
value which is 'name'. 

how do I get it.
[1]  1 NA NA NA

my thinking stops right here... 

list operations in R is too tough to digest and there
is not good documentations. 

Could any one please help. 

thanks
Srini
--- Benilton Carvalho <bcarvalh at jhsph.edu> wrote: