[R] (no subject)

Giorgio Garziano giorgio.garziano at ericsson.com
Sun Oct 4 21:49:33 CEST 2015


Good question.

> str(Empl[c(2,4)])
List of 2
$ family:List of 3
  ..$ spouse    : chr "Fred"
  ..$ children  : num 3
  ..$ child.ages: num [1:3] 4 7 9
$ family:List of 3
  ..$ spouse    : chr "Mary"
  ..$ children  : num 2
  ..$ child.ages: num [1:2] 14 17
>

> Empl[c(2,4)][1]
$family
$family$spouse
[1] "Fred"

$family$children
[1] 3

$family$child.ages
[1] 4 7 9


> Empl[c(2,4)][2]
$family
$family$spouse
[1] "Mary"

$family$children
[1] 2

$family$child.ages
[1] 14 17


> Empl[c(2,4)][[1]][1]
$spouse
[1] "Fred"

> Empl[c(2,4)][[2]][1]
$spouse
[1] "Mary"


> Empl[c(2,4)][[1]]$spouse
[1] "Fred"


> Empl[c(2,4)][[2]]$spouse
[1] "Mary"


	[[alternative HTML version deleted]]



More information about the R-help mailing list