get_vars {epiflows}R Documentation

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 class 'epiflows'
get_vars(x, what = NULL, id = TRUE, vector = FALSE, ...)

set_vars(x, ...)

set_vars(x, name) <- value

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

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

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

Value

A data frame with the variables requested

Author(s)

Thibaut Jombart, Zhian Kamvar

See Also

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

Examples

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)

[Package epiflows version 0.2.1 Index]