Remove geometry column from sf objects
Arguments
- df
(required; dataframe, tibble, or sf) A dataframe with responses (optional) and predictors. Must have at least 10 rows for pairwise correlation analysis, and
10 * (length(predictors) - 1)for VIF. Default: NULL.- quiet
(optional; logical) If FALSE, messages are printed. Default: FALSE.
- ...
(optional) Internal args (e.g.
function_nameforvalidate_arg_function_name, a precomputed correlation matrixm, or cross-validation args forpreference_order).
See also
Other argument_validation:
validate_arg_df(),
validate_arg_df_not_null(),
validate_arg_encoding_method(),
validate_arg_f(),
validate_arg_function_name(),
validate_arg_max_cor(),
validate_arg_max_vif(),
validate_arg_predictors(),
validate_arg_preference_order(),
validate_arg_quiet(),
validate_arg_responses()
Examples
data(vi_smol)
#creating fake geometry column without sf loaded
vi_smol$geometry <- NA
attr(
x = vi_smol,
which = "sf_column"
) <- "geometry"
#check new attribute
attributes(vi_smol)$sf_column
#> [1] "geometry"
#drop geometry column
df <- drop_geometry_column(
df = vi_smol
)
#>
#> collinear::drop_geometry_column(): dropping geometry column from 'df'.
#checking that the geometry was droppped
"geometry" %in% colnames(df)
#> [1] FALSE
attributes(df)$sf_column
#> NULL
