Learn R Programming

rangeMapper (version 2.0.3)

rmap_save_subset: Save subsets

Description

rmap_save_subset creates subsets based on the canvas properties and/or the properties of one or several bio tables.

Usage

rmap_save_subset(con, dst, ...)

# S4 method for rmapConnection,character rmap_save_subset(con, dst, ...)

Value

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

Arguments

con

a rangeMapper connection made with rmap_connect().

dst

the name of the new subset table.

...

SQL WHERE calls, see Details.

Details

Subsets are defined using table_name = "CONDITION" where CONDITION can be any SQL WHERE call defined for the given table. Here is a summary of the SQL operators relevant in this context:

OperatorDescription
= or == or IS or ! = or <> or IS NOTEquals or Non-equals.
> or < or >= or <=Greater (Less) than (or equal).
IN or NOT INmultiple given values e.g. a IN (a,b,c,x,y).
BETWEENBetween a given range (given values included) e.g. BETWEEN 1 and 10.
LIKEPattern search e.g. LIKE "%keyword%". LIKE is case insensitive.
GLOBSimilar to LIKE but uses the Unix wildcards (*,?,[]). e.g. [a-zA-Z0-9] matches any single alphanumeric. GLOB` is case sensitive.

Examples

Run this code
require(rangeMapper)
con = rmap_connect()
wrens = read_wrens()
rmap_add_ranges(con, x = wrens, ID = 'sci_name')
rmap_prepare(con, 'hex', cellsize = 500)
rmap_add_bio(con, wrens, 'sci_name')
rmap_save_map(con) 
rmap_save_subset(con,'s1', 
   species_richness = 'species_richness > 10', 
   wrens = 'body_mass > 19 AND clutch_size > 3')

dbDisconnect(con)

Run the code above in your browser using DataLab