Skip to contents

Given various inputs, provide a col_type specification in the format indicated by outtype

Usage

col_types(
  x,
  outtype = c("chr", "hud", "fun", "typ", "col")[1],
  is_raw_column = TRUE
)

Arguments

x

(vector/function) One of:

  • column (any)

  • a type specification from HUD (character)

  • a readr parse_* function (See parse_logical) (function)

  • a readr type specification (See cols) (character)

outtype

(character) One of:

  • "chr" Returns the class as a readr abbreviation (See cols)

  • "hud" (character) a type specification from HUD

  • "fun"a readr parse_* function (See parse_logical) (function)

  • "typ" (character) The R data class

  • "col" (character) The collector

is_raw_column

Is x a raw column input and the class should be used?

Value

See outtype

Examples

glue::glue_collapse(purrr::map_chr(iris, col_types))
#> nnnnf
if (FALSE) {
 # only run if readr is installed, otherwise will throw error
 purrr::map(iris, col_types, outtype = "col")
}