extractValue: Extract values for prior distributions

Description Usage Arguments Value Examples

Description

Internal functions used in prep_init_list and prep_prior_list to extract numerical values from priors. All use regular expressions as implemented in the stringr package, and all properly handle whitespace and decimals.

extract_first gets the first value, that is, the one after an open parenthesis and before a comma.

extract_last gets the last value, that is, the value after a comma and before a close parenthesis.

extract_only gets the only value from a distribution with one parameter, that is, it gets the numbers between two parentheses.

Usage

1
2
3
4
5
extract_first(string)

extract_last(string)

extract_only(string)

Arguments

string

The string to extract a value from.

Value

A numeric value.

Examples

1
2
3
4
5
6
## Not run: 
extract_first("uniform(32,45)") # returns 32
extract_last("uniform(32,45)") # returns 45
extract_only("exponential(32)") # returns 32

## End(Not run)

tjthurman/BAHZ documentation built on May 30, 2020, 8:28 a.m.