Skip to contents

Remove geometry column from sf objects

Usage

drop_geometry_column(df = NULL, quiet = FALSE, ...)

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_name for validate_arg_function_name, a precomputed correlation matrix m, or cross-validation args for preference_order).

Value

dataframe

Author

Blas M. Benito, PhD

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