col_types: Converts input to a specified type output

View source: R/utils_file_io.R

col_typesR Documentation

Converts input to a specified type output

Description

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

See Also

Other file IO: dep_read(), dep_write(), dir_fn(), dirs, ext(), file_fn(), is_filepath(), last_updated(), list.files2(), load_obj(), make_names(), mkpath(), move_files_to_folder(), needs_update(), object_fn(), object_write(), package_size(), write_dir_fn(), write_lines()

Examples

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

## End(Not run)


yogat3ch/UU documentation built on May 31, 2024, 10:14 p.m.