iconvert {interfacer} | R Documentation |
Convert a dataframe to a format compatible with an interface specification
Description
This function is called by ivalidate
and is not generally intended to be
used directly by the end user. It may be helpful in debugging during package
development to interactive test a iface
spec. iconvert
is an interactive
version of ivalidate
.
Usage
iconvert(
df,
iface,
.imap = interfacer::imapper(),
.dname = "<unknown>",
.fname = "<unknown>",
.has_dots = TRUE,
.prune = FALSE,
.env = rlang::current_env()
)
Arguments
df |
the dataframe to convert |
iface |
the interface spec as an |
.imap |
an optional |
.dname |
the name of the parameter value (optional). |
.fname |
the name of the function (optional). |
.has_dots |
internal library use only. Changes the nature of the error message. |
.prune |
do you want to remove non matching columns? |
.env |
internal use only |
Value
the input dataframe coerced to be conformant to the iface
specification, or an informative error is thrown.
Examples
i_diamonds = iface(
color = enum(D,E,F,G,H,I,J,extra) ~ "the colour",
price = integer ~ "the price"
)
iconvert(ggplot2::diamonds, i_diamonds,.prune = TRUE)
[Package interfacer version 0.2.3 Index]