Creating Land Mask with randomPoints Error

92 views Asked by At

I am trying to create a background land mask for my data. All of the questions I've seen are for CDO, which I cannot get to load into my R Studio (package ‘cdo’ is not available (for R version 4.0.2)). I am looking at shellfish data where the points are very close to land but only the ocean points are relevant.

I am currently trying to do this code:

background <- dismo::randomPoints(
  mask = mask, # provides resolution
  n=1036800, #number of random points
  ext = geographic.extent, #spatially restricts sampling
  extf = 1.25 #expands the sampling by 25% 
)

But I receive this error

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘nlayers’ for signature ‘"standardGeneric"’

I have tried to add specific libraries like library("conflicted") or require(dplyr) or even change the way I have been doing land masks altogether and have not found a solution.

0

There are 0 answers