Learn R Programming

rangeMapper (version 0.0-4)

rangeMap.save: Compute a chosen statistic at each canvas cell

Description

Compute a chosen statistic (richness, average, median or any user-defined statistic) at each grid cell and save/retrieve the data from the database. rangeMap.save is basically an sql constructor; the sql query can be shown by changing show.sql argument to FALSE. In the case of simple functions like species richness (count) or average, FUN is computed by the database engine, otherwise rangeMap.save constructs the query and uses lapply to compute FUN.

Usage

rangeMap.save(dbcon, FUN = richness, biotab = NA, biotrait,table.nam, subset = NULL, show.sql = FALSE)
rangeMap.fetch(dbcon, map)
rangeMap.plot(map, colorpalette, ncols, style, scales = FALSE)

Arguments

dbcon
A valid sqlite connection.
FUN
the function to be applied to each pixel. If FUN is missing then species richness (species count) is computed.
biotab
quoted name of the BIO table previously saved by bio.save (without the BIO preffix.)
biotrait
A two sided formula to be passed to assemblage.stat. The left side of the formula identifies the y BIO table variable to be mapped . The right side o
table.nam
Name of the table (quoted) to be added to the sqlite database. The prefix MAP will be appended to table.nam prior to saving.
subset
A named list. Names reffers to BIO, MAP and metadata_rages table names while the objects in the list are character strings containing the SQL WHERE
show.sql
A logical value. If TRUE then the sql code to be executed in the project's database is printed to the screeen. If FALSE, the default, the MAP is saved to the project's database.
map
Quoted name of the map table (without the MAP prefix) to fetch from the sqlite database.
colorpalette
A vector of colors; see also tkColorPalette which allows for interactive choice of color palettes
ncols
number of color classes required; argument to be passed to classIntervals
style
class interval style; see classIntervals for more details
scales
If TRUE, axes scale are drawn. This is an argument to be passed to spplot

Value

  • rangeMap.saveif not the MAP table was not saved to the database then the SQL string is returned for inspection.
  • rangeMap.fetchreturns a SpatialPixelsDataFrame object.

See Also

rangeMapper for a complete example.