I'm trying to generate a presence-absence matrix grid based on the example code from the letsR
package and lets.presab.points()
function.
Example code:
species <- c(rep("sp1", 100), rep("sp2", 100),
rep("sp3", 100), rep("sp4", 100))
x <- runif(400, min = -69, max = -51)
y <- runif(400, min = -23, max = -4)
xy <- cbind(x, y)
PAM <- lets.presab.points(xy, species, xmn = -93, xmx = -29,
ymn = -57, ymx = 15)
summary(PAM)
My code:
records <- read.csv("directoryremovedforprivacy.csv")
x <- records$lon
y <- records$lat
xy <- cbind(x, y)
PAM2 <- lets.presab.points(xy, records, xmn = -11.5, xmx = 3,
ymn = 49, ymx = 61)
summary(PAM2)
However I get the following error:
Error in xy[pos, , drop = FALSE] : (subscript) logical subscript too long
In addition: Warning message:
In xtfrm.data.frame(x) : cannot xtfrm data frames
> summary(PAM2)
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'summary': object 'PAM2' not found