drop_cols: drop_cols

View source: R/drop_cols.R

drop_colsR Documentation

drop_cols

Description

This function takes a dataframe and drops or retains fields based on the uniformity of their values.

Usage

drop_cols(
  df = NULL,
  justDropNAs = TRUE,
  uniformFields = "retain",
  keepFields = NULL,
  quietly = T
)

Arguments

df

default is NULL. This is the dataframe you want to handle.

justDropNAs

default is TRUE. If this value is TRUE, the script will only drop fields that are solely populated with NAs. If FALSE, it will drop/retain iother fields depending on the following parameters.

uniformFields

default is 'retain'. This determines how the script will handle uniform fields. It can either retain them or drop them. Valid values are 'retain' or 'drop'. 'drop' specifies that any field that has a single value for all entries will be dropped. This is useful for identifying the fields that can be used to differentiate records. 'retain' specifies that only those fields which have a single value for all entries will be retained. This is useful for identifying the fields with values that are shared by all records in a dataframe.

keepFields

default is NULL.This is a vector of column names you definitely want to retain, regardless of the values.

quietly

default is FALSE. By default, this function will not output messages, but they can be turned on by setting this to TRUE

Value

dataframe

Author(s)

Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca

See Also

Other general_use: DDMMSS_to_DD(), DDMMx_to_DD(), aggregator(), clip_by_poly(), combine_lists(), df_qc_spatial(), df_sf_to_gpkg(), df_to_sf(), prepare_shape_fields(), subset_by_time(), updateCheck()


Maritimes/Mar.utils documentation built on Feb. 12, 2024, 11:38 p.m.