Parse a string into a number, NA or to remain as a string
Arguments
- x
The character string to parse
Value
One of: a number, NA or the original string
Examples
parse_string("NA")
#> [1] NA
parse_string("notanumber")
#> [1] "notanumber"
parse_string("100")
#> [1] 100
parse_string("0.45")
#> [1] 0.45
parse_string("false")
#> [1] FALSE