Learn R Programming

epiflows (version 0.2.2)

get_vars: Access location metadata

Description

This accessor extracts variables from the locations data frame in an epiflow object. get_vars is a generic with a method defined for epiflows objects.

Usage

get_vars(x, ...)

# S3 method for epiflows get_vars(x, what = NULL, id = TRUE, vector = FALSE, ...)

set_vars(x, ...)

set_vars(x, name) <- value

# S3 method for epiflows set_vars(x, ...)

# S3 method for epiflows set_vars(x, name) <- value

Value

A data frame with the variables requested

Arguments

x

An epiflows object.

...

For set_vars(), any number of variables defined in global_vars() that can be used for mapping or modelling. This is unused in get_vars()

what

a valid character string specifying the variable desired. If `NULL` (default), the names of the available vars will be returned.

id

a logical. If `TRUE` (default), the `id` column of the locations will be the first column of the data frame. if `FALSE`, the variable will be returned with identifiers as row names.

vector

if `TRUE` the result will be coerced into a vector (or a matrix in the case of coordinates)

name

the name of the variable in global_vars() to assign

value

the name of the column in the locations data

Author

Thibaut Jombart, Zhian Kamvar

See Also

global_vars(); make_epiflows(); get_pop_size(); get_id()

Examples

Run this code
data("Brazil_epiflows")
get_vars(Brazil_epiflows) # defined global variables pointint to column names
get_vars(Brazil_epiflows, "duration_stay")
get_vars(Brazil_epiflows, "duration_stay", vector = TRUE)

Run the code above in your browser using DataLab