[R] list subselect by name ?
Andre Mikulec
andre_mikulec at hotmail.com
Sat Sep 9 20:45:55 CEST 2017
list subselect by name ?
-------------------------
I have this 'list of two elements of named elements.'
> list(letters=letters, LETTERS=LETTERS)[c("letters","LETTERS")]
$letters
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
$LETTERS
[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S"
[20] "T" "U" "V" "W" "X" "Y" "Z"
> str( list(letters=letters, LETTERS=LETTERS)[c("letters","LETTERS")] )
List of 2
$ letters: chr [1:26] "a" "b" "c" "d" ...
$ LETTERS: chr [1:26] "A" "B" "C" "D" ...
What code do I need to write in place of ??????????????????
to return a 'list of one element that is named.'
> list(letters=letters, LETTERS=LETTERS)????????????????????
$LETTERS
[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S"
[20] "T" "U" "V" "W" "X" "Y" "Z"
> str( list(letters=letters, LETTERS=LETTERS)???????????????????? )
List of 1
$ LETTERS: chr [1:26] "A" "B" "C" "D" ...
Thanks,
Andre Mikulec
Andre_Mikulec at Hotmail.com
[[alternative HTML version deleted]]
More information about the R-help
mailing list