[R] Count observation

MarcioRibeiro mestat at pop.com.br
Thu Jun 11 21:13:31 CEST 2009


Hi listers,
I have the following code...

data<-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE)
n<-nrow(data)
m<-n-1
boot<-data[sample(m,replace=T),]

So, I need to count the number of times each observation was selected at the
sample with replacement...
Suppose I sampled...
4 5 1 3 7 5 1 4 7

So, I would count...
x  count
1  2
2  0
3  1
4  2
5  2
6  0
7  2
8  0
9  0
10 0

Thanks in advance,
Marcio
-- 
View this message in context: http://www.nabble.com/Count-observation-tp23987251p23987251.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list