Re: [R] Is there any method to do spatial sampling?

From: Milton Cezar Ribeiro <milton_ruser_at_yahoo.com.br>
Date: Mon 30 Oct 2006 - 02:51:18 GMT


May be this work for rectangular image.    

  require(rimage)
  img<-read.jpeg("file.jpg")
image(rgb2grey(img))
  nsamples<-1000
  coordinates<-NULL
for (i in 1:nsamples) {
 coordinates<-rbind(
  coordinates,
  cbind(x=as.integer(nrow(img)*runif(1)),   y=as.integer(ncol(img)*runif(1))))
 }     

  But I sugest you give a look at "adehabitat" and "rimage" packages.    

  Best,    

  Miltinho

ronggui <ronggui.huang@gmail.com> escreveu:   I have a map of a district (which is JPG format), and I want to do a sptial sampling based on the map. So is there any function to do spatial sampling of this type?

Thanks!

-- 
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China
黄荣贵
复旦大学社会学系


______________________________________________
R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --------------------------------- [[alternative HTML version deleted]]


______________________________________________
R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Tue Oct 31 02:58:55 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 16:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.