R snippets

# 리스트를 만들자!
> abcde=c("a","b","c","d","e")
> nato.abcde=c("Alpha","Bravo","Charlie","Delta","Echo")
> myList.row = setNames(as.list(nato.abcde),abcde)
> myList.col = list(alphabet = abcde, nato.phonetic.code = nato.abcde)
> myList.row$a
[1] "Alpha"
> myList.col$alphabet[3]
[1] "c"
> myList.row$a
[1] "Alpha"
> myList.col$nato.phonetic.code[3]
[1] "Charlie"
> myList.row["b"]
$b
[1] "Bravo"
> myList.col$nato.phonetic.code[which(myList.col$alphabet == "c")]
[1] "Charlie"
> > as.data.frame(myList.col)[which(myList.col$alphabet == "e"),]
  alphabet nato.phonetic.code
5        e               Echo