Skip to contents

shrthnd_list() generates a lookup table of shorthand markers in a vector, either a character vector containing shorthand or a shrthnd_num() vector.

Usage

shrthnd_list(
  x,
  shorthand = NULL,
  na_values = c("", "NA"),
  dec = ".",
  bigmark = ","
)

Arguments

x

A character vector containing shorthand, or a shrthnd_num() vector

shorthand

A character vector of shorthand values to validate tags against

na_values

A character value of NA values to ignore

dec

The decimal separator for numbers

bigmark

The separator to the left of the decimal separator

Value

A list of shorthand positions in a vector

Examples

x <- c("12", "34.567", "[c]", "NA", "56.78[e]", "78.9", "90.123[e]")
shrthnd_list(x)
#> <shrthnd_list[2]>
#> [c] (1 location): 3 
#> [e] (2 locations): 5, 7 

sh_x <- shrthnd_num(x)
sh_x
#> <shrthnd_num[7]>
#> [1] 12.00     34.57        NA [c]    NA     56.78 [e] 78.90     90.12 [e]
shrthnd_list(sh_x)
#> <shrthnd_list[2]>
#> [c] (1 location): 3 
#> [e] (2 locations): 5, 7