[R] Sampling With R

Nathan Cooper nathanwands at hotmail.com
Thu Sep 18 22:43:45 CEST 2003


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]]
[1]  1 10  2 32 43 54 65 NA

[[2]]
[1]  2  1 32  6  5 44  3  2

[[3]]
[1]  3  3 22 56  7 NA NA NA

[[4]]
[1]  4 23  4 33 NA NA NA NA

[[5]]
[1]  5 22 12  2  2  2 32 NA

[[6]]
[1]  6 22 32 43 23  5 NA NA

I'm going to analyze how density changes with number of visits. So I will 
sample 1 visit (row) x number of times and export the distances to the 
program DISTANCE. I know that I can do the sampling part using:

sample(a,x,replace=TRUE,prob=NULL) This works fine. But I also need to 
sample 2 visits (rows) out of visits 1-3 and then 2 visits out of visits 
4-6, and so on x number of times. Any ideas?

Thanks much,

Nathan Cooper
Utah Division of Wildlife Resources
nathanwands at hotmail.com

_________________________________________________________________
Use custom emotions -- try MSN Messenger 6.0! 
http://www.msnmessenger-download.com/tracking/reach_emoticon




More information about the R-help mailing list