Skip to contents

Parse a string into a number, NA or to remain as a string

Usage

parse_string(x)

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