readr (version 1.1.1)

parse_number: Parse numbers, flexibly

Description

This drops any non-numeric characters before or after the first number. The grouping mark specified by the locale is ignored inside the number.

Usage

parse_number(x, na = c("", "NA"), locale = default_locale())

col_number()

Arguments

x

Character vector of values to parse.

na

Character vector of strings to use for missing values. Set this option to character() to indicate no missing values.

locale

The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use locale() to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.

See Also

Other parsers: col_skip, parse_datetime, parse_factor, parse_guess, parse_logical

Examples

Run this code
# NOT RUN {
parse_number("$1000")
parse_number("1,234,567.78")
# }

Run the code above in your browser using DataCamp Workspace