Converts input to a specified type output
col_types.RdGiven 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 readrparse_*function (See parse_logical)(function)"typ"(character)The R data class"col"(character)Thecollector
- is_raw_column
Is x a raw column input and the
classshould be used?
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))
#> nnnnf
if (FALSE) {
# only run if readr is installed, otherwise will throw error
purrr::map(iris, col_types, outtype = "col")
}