Skip to contents

get_config() allows the user to examine the values of one or more configurations as currently set in the movenet environment.

Usage

get_config(...)

Arguments

...

One or more configuration names, in the form of individual character strings, a character vector, or a list.

Value

  • If no arguments are provided, an unstructured named list of all configurations as currently set in the movenet environment.

  • If one or more configuration names are provided, an unstructured named list with the current value of these configurations, or an empty named list and a warning if the configurations are unset or ambiguous.

Details

Configuration names

Each configuration name must follow the "datatype_configtype.configname" format, consisting of the following elements:

  • datatype: Type of data the configuration applies to. Either movedata or holdingdata.

  • configtype: Type of configuration. Either fileopts (file options) or cols (column headers/indices).

  • configname: Name of the specific configuration.

For example: "movedata_fileopts.separator", "holdingdata_cols.id"

get_config() uses partial matching for configuration names. If a configuration name is ambiguous or unrecognised (e.g. if the configuration is unset), a warning is displayed.

See also

vignette("configurations") for an explanation of the movenet config system.

Other configurations-related functions: change_config(), load_config(), new_config(), save_config(), validate_config()

Examples

# Set-up: Save movenet environment with current configurations
movenetenv <- movenet:::movenetenv
old_config <- movenetenv$options

# Load a config file
load_config(system.file("configurations", "fakeScotEID_holding.yml", package="movenet"))
#> Successfully loaded config file: C:/Users/cboga/AppData/Local/Temp/Rtmp25xhub/temp_libpath11484970381d/movenet/configurations/fakeScotEID_holding.yml
get_config() #Examine configurations
#> $holdingdata_fileopts.separator
#> [1] ","
#> 
#> $holdingdata_fileopts.encoding
#> [1] "UTF-8"
#> 
#> $holdingdata_fileopts.decimal
#> [1] "."
#> 
#> $holdingdata_fileopts.coord_EPSG_code
#> [1] 27700
#> 
#> $holdingdata_fileopts.country_code
#> [1] "UK"
#> 
#> $holdingdata_cols.id
#> [1] "cph"
#> 
#> $holdingdata_cols.coord_x
#> [1] "easting"
#> 
#> $holdingdata_cols.coord_y
#> [1] "northing"
#> 
#> $holdingdata_cols.type
#> [1] "holding_type"
#> 
#> $holdingdata_cols.herd_size
#> [1] "herd_size"
#> 

# Query the values of all configurations
get_config()
#> $holdingdata_fileopts.separator
#> [1] ","
#> 
#> $holdingdata_fileopts.encoding
#> [1] "UTF-8"
#> 
#> $holdingdata_fileopts.decimal
#> [1] "."
#> 
#> $holdingdata_fileopts.coord_EPSG_code
#> [1] 27700
#> 
#> $holdingdata_fileopts.country_code
#> [1] "UK"
#> 
#> $holdingdata_cols.id
#> [1] "cph"
#> 
#> $holdingdata_cols.coord_x
#> [1] "easting"
#> 
#> $holdingdata_cols.coord_y
#> [1] "northing"
#> 
#> $holdingdata_cols.type
#> [1] "holding_type"
#> 
#> $holdingdata_cols.herd_size
#> [1] "herd_size"
#> 

# Query the values of specific configurations
get_config("holdingdata_fileopts.separator", "holdingdata_cols.id")
#> $holdingdata_fileopts.separator
#> [1] ","
#> 
#> $holdingdata_cols.id
#> [1] "cph"
#> 

# Clean-up: Reinstate previous configurations
movenetenv$options <- old_config
rm("old_config", "movenetenv")