_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › OrderedAndUnorderedFactors

Contents

1 A specific example
2 The function tapply() and ragged arrays


1 A specific example #

factor() 蠏碁9螻 伎. statef 螳 1 2螳願, 襾語 螳れ 螳螳 1螳企. 蟆郁骸 'Levels:' れ 蠏碁9 螳れ 蟆 覲 . factor(state)螳 levels()襯 levels 螳襷 螳語 .
> state <- c(1,4,2,1,5,0)
> statef <- factor(state)
> statef
[1] 1 4 2 1 5 0
Levels: 0 1 2 4 5
> levels(statef)
[1] "0" "1" "2" "4" "5"
> levels(factor(state))
[1] "0" "1" "2" "4" "5"
>

2 The function tapply() and ragged arrays #

tapply() memebers incomes襯 蟆壱伎手, 讌螻一郁讌 伎.
> members <- c("lee", "kim", "park", "song", "kang", "lee", "kang")
> incomes <- c(100, 10, 45, 122, 549, 12, 94)
> tapply(incomes, members, mean)
 kang   kim   lee  park  song 
321.5  10.0  56.0  45.0 122.0 
> tapply(incomes, members, max)
kang  kim  lee park song 
 549   10  100   45  122 
> tapply(incomes, members, min)
kang  kim  lee park song 
  94   10   12   45  122 
> tapply(members, incomes, min)
    10     12     45     94    100    122    549 
 "kim"  "lee" "park" "kang"  "lee" "song" "kang" 
> 
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

螳 蟇碁Μ螻 企れ 襷蟆讌襷 讌 讌 轟 磯蟆 覃 谿豸 語 螳覯殊讌. (L.M.貉)