type_ensure {fgeo.tool} | R Documentation |
Ensure the specific columns of a dataframe have a particular type.
Description
Ensure the specific columns of a dataframe have a particular type.
Usage
type_ensure(df, ensure_nms, type = "numeric")
Arguments
df |
A dataframe. |
ensure_nms |
Character vector giving names of |
type |
A string giving the type to ensure in columns |
Value
A modified version of df
, with columns (specified in ensure_nms
)
of type type
.
See Also
Other functions to operate on column types:
type_vft()
Other functions for developers:
check_crucial_names()
,
extract_insensitive()
,
flag_if_group()
,
is_multiple()
,
nms_try_rename()
,
rename_matches()
Examples
dfm <- tibble(
w = c(NA, 1, 2),
x = 1:3,
y = as.character(1:3),
z = letters[1:3]
)
dfm
type_ensure(dfm, c("w", "x", "y"), "numeric")
type_ensure(dfm, c("w", "x", "y", "z"), "character")
[Package fgeo.tool version 1.2.10 Index]