Learn R Programming

readr (version 0.1.1)

collector: Parse character vectors into typed columns.

Description

Use parse_ if you have a character vector you want to parse. Use col_ in conjunction with a read_ function to parse the values as they're read in.

Usage

col_character()

parse_character(x)

col_integer()

parse_integer(x)

col_double()

parse_double(x)

col_euro_double()

parse_euro_double(x)

col_numeric()

parse_numeric(x)

col_logical()

parse_logical(x)

col_factor(levels, ordered = FALSE)

parse_factor(x, levels, ordered = FALSE)

col_skip()

Arguments

x
Character vector of values to parse.
levels
Character vector providing set of allowed levels.
ordered
Is it an ordered factor?

See Also

parse_datetime, type_convert to automatically re-parse all character columns in a data frame.

Examples

Run this code
parse_integer(c("1", "2", "3"))
parse_double(c("1", "2", "3.123"))
parse_euro_double(c("1", "2", "3,123"))
parse_factor(c("a", "b"), letters)
parse_numeric("$1,123,456.000")

# If there are parsing problems, you'll get a warning message saying
# how many. Use problems() to access a data frame giving more details.
x <- parse_integer(c("1X", "blah", "3"))
problems(x)

Run the code above in your browser using DataLab