[R] Edges and Rasters

Sarah Goslee sarah.goslee at gmail.com
Fri Jun 22 15:00:10 CEST 2012


There's almost certainly a more elegant way to do it, but this works:

r <- raster(nrow=30, ncol=30, xmn=0)
r[]<-NA
r[393:409]<-99
r[423:439]<-99
r[453:455]<-99
r[456:460]<-30
r[461:469]<-99
r[483:499]<-99
r[513:529]<-99

plot(r,col=terrain.colors(100))
plot(edge(r, type="outer"), col=c("transparent", "black"), add=TRUE,
legend=FALSE)

plot(r,col=terrain.colors(100))
plot(edge(r, type="outer"), col=c("transparent", "black"), add=TRUE,
legend=FALSE)
plot(edge(edge(r, type="outer"), type="outer"), col=c("transparent",
"black"), add=TRUE,
legend=FALSE)

Also, Nabble is not the R-help list. Please include context in your
replies. Many people cannot or will not go look at the Nabble archives
to figure out what on earth you're talking about.

Sarah

On Thu, Jun 21, 2012 at 4:46 AM, riodementa <jorge.nayamacias at gmail.com> wrote:
> Lot of thanks Sarah!
> It works!, and sorry for don`t say that I'm using Windows7.
> And i have another question. Do you know if it is possible to plot the edge
> using 2 or more cells?
> What I'm trying to do is an edge wider, and i don'care lose some of the
> information inside or outside around the edge.
> Any idea?
>
> Again thanks
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Edges-and-Rasters-tp4633966p4634075.html

> Sent from the R help mailing list archive at Nabble.com.
Lies, but not statistics.

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list