Hi all,

Could anybody tell me why this happens?
When I generate a raster from a group of coordinates, it leaves some
outside of it. changing the cell size of the raster and increasing the
extent of the raster did not solve the problem.

There goes a reproducible example,
Thanks in advance and see (some of) you soon.


brownian=function(n=1000,fun=rnorm)
{
  x<-cumsum(fun(n))
  y<-cumsum(fun(n))
  coor=data.frame(x,y,id)
  return(coor)
}

require(raster)
require(sp)
c=coords=brownian(50,fun=rnorm)
coordinates(c)=c(1,2)
r=raster(c)
cellsiz=3
res(r) <- cellsiz
extend(r, c(1,0))
p= rasterToPolygons(r)
plot(p)
points(coords,col="black")
cellFromXY(r, coords)


-- 
Agustín Camacho Guerrero.
Doutor em Zoologia.
Laboratório de Herpetologia, Departamento de Zoologia, Instituto de
Biociências, USP.
Rua do Matão, trav. 14, nº 321, Cidade Universitária,
São Paulo - SP, CEP: 05508-090, Brasil.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to