Maps are aggregate summaries computed for each canvas cell.

rmap_save_map(con, fun, src, v, subset, dst, ...)

# S4 method for rmapConnection,missing,missing,missing,missing,missing
rmap_save_map(con)

# S4 method for rmapConnection,missing,missing,missing,character,character
rmap_save_map(con, subset, dst)

# S4 method for rmapConnection,character,character,character,missing,character
rmap_save_map(con, fun, src, v, dst)

# S4 method for rmapConnection,character,character,character,character,character
rmap_save_map(con, fun, src, v, subset, dst)

# S4 method for rmapConnection,`function`,character,character,missing,character
rmap_save_map(con, fun, src, v, subset, dst, ...)

# S4 method for rmapConnection,`function`,character,character,character,character
rmap_save_map(con, fun, src, v, subset, dst, ...)

# S4 method for rmapConnection,`function`,character,ANY,missing,character
rmap_save_map(con, fun, src, v, subset, dst, ...)

# S4 method for rmapConnection,`function`,character,ANY,character,character
rmap_save_map(con, fun, src, v, subset, dst, ...)

# S4 method for rmapConnection,character,Raster,missing,missing,character
rmap_save_map(con, fun, src, v, subset, dst, ...)

Arguments

con

a rangeMapper connection made with rmap_connect().

fun

the name of the function to save, either an SQLite or an R function. see Details.

src

the name of the source table previously imported by rmap_add_bio().

v

the variable to map or a function taking several variables as arguments. and returning one or several values.

subset

the name of a subset table. see rmap_save_subset.

dst

the name of the new map table.

...

arguments passed to fun.

Value

TRUE when a table or a database view is written to the project file, FALSE otherwise.

Details

rmap_save_map makes maps based on data within the project or based on external raster objects. Aggregate functions can be:

  • internal SQL aggregate functions: 'avg', 'count', 'max', 'min', 'sum', 'stdev', 'variance', 'mode', 'median', 'lower_quartile', 'upper_quartile', 'group_concat'.

  • R functions taking one argument and returning one value.

  • arbitrary statistical models applied on bio tables.

Examples

#> Loading required package: data.table
#> data.table 1.14.0 using 18 threads (see ?getDTthreads). Latest news: r-datatable.com
con = rmap_connect() wrens = read_wrens() rmap_add_ranges(con, x = wrens, ID = 'sci_name') rmap_prepare(con, 'hex', cellsize=500)
#> --> Making hex canvas ...
#> done.
#> (i) The canvas has 576 cells.
#> --> Processing 84 ranges ...
#> --> Updating rmap_nfo & rmap_master tables ...
#> done.
#> (i) Finished in 0.096s elapsed (0.108s cpu)
rmap_save_map(con) # default is a species_richness map. rmap_add_bio(con, wrens, 'sci_name') rmap_save_map(con, fun='avg', src='wrens',v='body_mass', dst='avg_bodymass') rmap_save_subset(con,dst ='ss1', species_richness = 'species_richness > 10') rmap_save_map(con,subset = 'ss1', dst ='sr2') rmap_save_map(con, fun='avg', src='wrens',v='body_mass', subset='ss1', dst='avg_bodymass_high_SR') rmap_save_map(con, fun= mean, na.rm = TRUE, src='wrens', v='body_mass', dst='mean_bodymass') Median = function(x) median(x,na.rm = TRUE) rmap_save_map(con, fun = Median, src='wrens', v='body_mass', dst='median_bodymass') rmap_save_map(con, fun= mean, na.rm = TRUE, src='wrens',v='body_mass', subset='ss1', dst='mean_bodymass_high_SR') linmod = function(x) { lm(clutch_size ~ log(female_tarsus), x) %>% summary %>% coefficients %>% data.table %>% .[-1] } rmap_save_map(con, fun= linmod, src='wrens', dst='slope_clutch_size') data(dem) rmap_save_map(con, fun= 'mean', src= dem , dst='dem', progress = FALSE) x = rmap_to_sf(con) dbDisconnect(con)