# 0. Load data & Selecting Data
# species occurances
species_occ <- read.csv(system.file("external/species/species_occ.csv",package="biomod2"))
# we consider only presences of MyocastorCoypus species
myRespName <- 'MyocastorCoypus'
myRespCoord <- species_occ[which(!is.na(species_occ[,myRespName])),c('x','y')]
myResp <- as.numeric(na.omit(species_occ[,myRespName]))
# Environemental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
myExpl = raster::stack(system.file("external/climat/current/bio3.grd",package="biomod2"),
system.file("external/climat/current/bio4.grd",package="biomod2"),
system.file("external/climat/current/bio7.grd",package="biomod2"),
system.file("external/climat/current/bio11.grd",package="biomod2"),
system.file("external/climat/current/bio12.grd",package="biomod2"))
# 1. Formating Data
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespCoord,
resp.name = myRespName,
PA.nb.rep = 2,
PA.nb.absences = 200,
PA.strategy = 'random')
myBiomodData
plot(myBiomodData)
Run the code above in your browser using DataLab