[R] Sampling in R

2006-03-23 Thread Noam Friedman
Hi all! I was wondering if you can help me with a little sampling issue I'm having in R. I have a database with 100 observations. I need to sample n=9 sample size, 200 times (i.e. get 200 samples of size 9). N (pop. size) =100 Each sample can't contain the same observation more than one

Re: [R] Sampling in R

2006-03-23 Thread Thomas Petzoldt
Does the following what you want: x - 1:100 s - matrix(0, nrow=200, ncol=9) for (i in 1:200) { s[i, ] - sample(x, 9) } m - rowMeans(s) hist(m) The default behavior of sample is without replacement. Thomas Noam Friedman wrote: Hi all! I was wondering if you can help me with a

Re: [R] Sampling in R

2006-03-23 Thread Sean Davis
On 3/23/06 5:52 AM, Noam Friedman [EMAIL PROTECTED] wrote: Hi all! I was wondering if you can help me with a little sampling issue I'm having in R. I have a database with 100 observations. I need to sample n=9 sample size, 200 times (i.e. get 200 samples of size 9). N (pop. size)

Re: [R] Sampling in R

2006-03-23 Thread pedro caƱadilla
I prefer the function resample as it is given in the sample help, in this way: resample - function(x, size, ...) { if length(x = 1) {if (!missing(size) size == 0) x[FALSE] else x} else sample(x, size, ...) } Anyway, if an observation can not be twice in the sample, you have to use

Re: [R] Sampling in R

2006-03-23 Thread Liaw, Andy
From: Sean Davis On 3/23/06 5:52 AM, Noam Friedman [EMAIL PROTECTED] wrote: Hi all! I was wondering if you can help me with a little sampling issue I'm having in R. I have a database with 100 observations. I need to sample n=9 sample size, 200 times (i.e. get 200 samples

[R] Sampling With R

2003-09-18 Thread Nathan Cooper
Hello, I'm going to use R to analyze some point count data and I need to use the sample function. Let's say that I have a data set like below with each row being a visit to a site and the numbers in the rows individual distances. The real data set will of course have many more rows. a [[1]]