Add variables (in raster format), usually environmental, to a PresenceAbsence object. Variables are included as additional columns containing the aggregate/summarize value of the variable(s) in each cell of the presenceabsence matrix.
1  lets.addvar(x, y, onlyvar = FALSE, fun = mean)

x 
A 
y 
Variables to be added in 
onlyvar 
If 
fun 
Function used to aggregate the variables(s) values over each cell. Note that this will only work for variables with a resolution value smaller (i.e. higher resolution) than the PAM. 
The result is a presenceabsence matrix of species with the variables added as columns at the rightend of the matrix (but see the 'onlyvar' argument).
The PresenceAbsence
and the Raster
variable must be in the same projection.
Bruno Vilela
1 2 3 4 5 6 7 8 9 10 11  ## Not run:
data(temp) # Global mean temperature
data(PAM) # Phyllomedusa presenceabsence matrix
# Mean temperature
PAM_temp_mean < lets.addvar(PAM, temp)
# Standard deviation of temperature
PAM_temp_sd < lets.addvar(PAM, temp, fun = sd, onlyvar = TRUE)
# Mean and SD in the PAM
PAM_temp_mean_sd < cbind(PAM_temp_mean, PAM_temp_sd)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.