Learn R Programming

scanstatistics (version 0.1.0)

zone_table_creator: Converts a list of zones to a data.table of zones and locations.

Description

Supply a list of zones, with each element of the list being a vector of locations. If the list is named, the output data.table will have these names for the zones. Else, the zones are labeled by integers from 1 to the length of the zone list.

Usage

zone_table_creator(zones, keys = NULL, offset = 0L)

Arguments

zones

A list of zones, elements being vectors of locations.

keys

Character vector of one or more column names which is passed to setkey.

offset

An integer to offset the zone numbering by, in case names are not used for the zones, and you want the zone count to start at offset + 1.

Examples

Run this code
# NOT RUN {
zone_table_creator(list(1L, 2L, 1:2))
zone_table_creator(sets::set(sets::set(1L), 
                     sets::set(2L), sets::as.set(1:2)))
zone_table_creator(list(1L, 2L, 1:2), keys = "location")
zone_table_creator(list(1L, 2L, 1:2), keys = "zone")
zone_table_creator(list(a = "x", b = "y", c = c("x", "y")))
# }

Run the code above in your browser using DataLab