Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 54187

Statistical computing language and software environment.

5 votes
1 answer
3k views

Identifying value of closest non-NA pixel

See below for an example of the distance function: library(raster) r <- raster(ncol=36,nrow=18) r[] <- NA r[500] <- 1 r[100] <-2 dist <- distance(r) #calculates the distance to … the nearest non-NA pixel Is there a function in a different package that does this (I'd like to stay in the R environment)? …
KevinB's user avatar
  • 115
6 votes
2 answers
5k views

Calculating Shannon's diversity using moving window in R

I have a raster where each pixel is a particular vegetation type. I'm interested in the diversity of vegetation types around each pixel. I'd like to assign a Shannon's diversity index value (see thi …
KevinB's user avatar
  • 115