| To: | Brian Wu <bwu@guzman.com>, s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | Re: how to generate indexed 3-dim variable |
| From: | "Richard M. Heiberger" <rmh@temple.edu> |
| Date: | Wed, 25 Jan 2006 14:07:36 -0500 |
> a <- array(1:24, dim=c(2,3,4),
+ dimnames=list(ONE=c("a","b"), TWO=c("d","e","f"), THREE=c("g","h","i","j")))
> a
, , g
d e f
a 1 3 5
b 2 4 6
, , h
d e f
a 7 9 11
b 8 10 12
, , i
d e f
a 13 15 17
b 14 16 18
, , j
d e f
a 19 21 23
b 20 22 24
> dimnames(a)
$ONE:
[1] "a" "b"
$TWO:
[1] "d" "e" "f"
$THREE:
[1] "g" "h" "i" "j"
> a[1,2,3]
[1] 15
> a["b","d","j"]
[1] 20
> a[ONE="a", 2, 4]
[1] 21
> ?array
>
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | how to generate indexed 3-dim variable, Brian Wu |
|---|---|
| Next by Date: | Re: how to generate indexed 3-dim variable, Patrick Burns |
| Previous by Thread: | Re: how to generate indexed 3-dim variable, Patrick Burns |
| Next by Thread: | Re: finding cutoff point for a continuous variable when outcome is binary., Im, Kelly |
| Indexes: | [Date] [Thread] [Top] [All Lists] |