Displaying 1 result from an estimated 1 matches for "awprob".
2001 Nov 12
2
[Q] Setting elements of a vector
Hi!
I'm new to R and have problems with the following code:
<code>
awprob<-c(0.4,0.4,0.1,0.1)
awsample<-sample(c(1:4),3,awprob,replace=TRUE)
vec<-vector(mode="numeric",10000)
vec[]<-sum(sample(c(1:4),20,awprob,replace=TRUE))
</code>
My problem: The elements of vec have the same value. How
can I tell R that I want to have a *new* sample for...