search for: things2

Displaying 1 result from an estimated 1 matches for "things2".

Did you mean: things
2011 Feb 02
1
A question about sampling
...0 0 0 0 0 0.192 0 0.067 0 0 I'd like a sample of size size.things (say, 47) of the 17 categories (with replacement). And I'd like to produce a vector of length 17 which enumerates the number of times each category has been selected. This is fairly straightforward to do; for instance: > things2<-table(factor(sample(1:17,size.things[1],replace=TRUE,prob=things),levels=1:17)) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 0 9 0 4 0 18 0 0 0 0 0 5 0 4 0 0 What would I need to do if I had a matrix things (50000 x 17) of probability weight vectors and a vector of samp...