On 11/10/2008, at 7:38 AM, Alex99 wrote:
>
> Hi Guys,
> I am in desperate need with sampling. I am suppose to sample from a
> dataset.
> I use the following code:
>
>> for(i in 1:5){temp[i]<-sample(T2,40,replace=F)
> + show(temp)}
>
> but all the samples are the same, but I want them to be different.any
> suggestion?
Yes. Read the posting guide.
(a) Your example is not reproducible. What is T2? How is temp
initialized?
(b) In the assignment temp[i] <- sample(T2,40,replace=FALSE)
you are attempting to assign a vector of length 40 to an object
of length 1; that can't possibly work, now, can it? It should
give you warning messages.
(c) I really can't figure out how you're getting ``all the samples are
the same''. Things go wrong, but not that.
Tell us what you *really* did.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}