R only lets me run part of a code. I get the warning "error in x : unused argument y"

35 views Asked by At

I a trying to set up MaxEnt so I am following a tuturiol on YT titled "how to decide which setting to use when running MaxEnt, as well as how to make a bias file"

I enter my occurrence points (occ) and stacked all my variables (env). Now I need to create a bias file.

i started with rasterizing my occurrence points

occur.ras <- rasterize(occ,env,1)

this worked. But the next code doesn't

presences <- which(values(occur.ras) == 1)
pres.locs <- coordinates(occur.ras)[presences,]
dens <- kde2d(pres.locs[,1], pres.locs[,2], n=c(nrow(occur.ras), ncol(occur.ras)), lins=c(extent(env)[1], extent(env)[2], extent(env)[3], extent(env)[4]))
dens.ras <- raster(dens,env)
dens.ras2 <- resample(dens.ras, env)

i get the error

Error in kde2d(pres.locs[, 1], pres.locs[, 2], n = c(nrow(occur.ras),  : 
 unused argument (lins = c(extent(env)[1], extent(env)[2], extent(env)[3], extent(env)[4]))

It does work if I take out

unused argument (lins = c(extent(env)[1], extent(env)[2], extent(env)[3], extent(env)[4])

but i am worried this will cause problems later down the line. Is there anyway i can make the WHOLE code work?

Thanks in advance

0

There are 0 answers