Skip to content
Prev 24689 / 29559 Next

Odd behavior of dismo's extract function

I am on R 3.3.1 and don't get the huge time difference.  There is a tiny
decrease though from 250 to 251:

=============
wd = "~/Downloads/extract_weirdness/"
setwd(wd)

library(raster)
library(dismo)


extract.test <- function(env, N){
      extract(env, randomPoints(env, N))
}

env.files <- list.files(path = ".", pattern = "pc", full.names =
TRUE)
env <- stack(env.files)


system.time(extract.test(env, 250))

   user  system elapsed
  1.455   0.043   1.492
Warning message:
In couldBeLonLat(mask) : CRS is NA. Assuming it is longitude/latitude


system.time(extract.test(env, 251))   user  system elapsed
  1.137   0.033   1.158
Warning message:
In couldBeLonLat(mask) : CRS is NA. Assuming it is longitude/latitude
=============

...but I won't worry about it myself.  Thanks for the solution though, that
was weird behavior!
Nick
On Mon, Jul 25, 2016 at 12:29 PM, Dan Warren <dan.l.warren at gmail.com> wrote: