[R] Subsetting simulation output
Murray Jorgensen
maj at waikato.ac.nz
Tue Aug 28 05:08:00 CEST 2001
Does anyone understand this?
I have a long vector parlist containing values of 138 parameters in 100
simulations.
The factor parno is defined by
trys <- 100
sim <- gl(trys,138)
parno <- gl(138,1,trys*138)
I want to extract and compare results for related groups of parameters but I
get inconsistent results:
> length(parlist[parno==37:42])
[1] 600
> length(parlist[parno==c(37,38,39,40,41,42)])
[1] 600
> length(parlist[parno==c(43, 48, 53, 58, 63, 68)])
[1] 200
Which I feel should be 600.
I am using R1.2.1 under Windows NT 4.0.
Murray Jorgensen
> tapply(parlist,parno,length)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
127 128 129 130 131 132 133 134 135 136 137 138
100 100 100 100 100 100 100 100 100 100 100 100
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz Fax +64-7 838 4155
Phone +64-7 838 4773 home phone +64-7 856 6705 Mobile +64-21 139 5862
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list