This function filters out columns containing the results of data quality tests (i.e., columns starting with '.') or other columns specified.

bdc_filter_out_flags(data, col_to_remove = "all")

Arguments

data

data.frame. Containing columns to be removed.

col_to_remove

logical. Which columns should be removed? Default = "all", which means that all columns containing the results of data quality tests are removed.

Value

A data.frame without columns specified in 'col_to_remove'.

Examples

x <- data.frame(
  database_id = c("test_1", "test_2", "test_3", "test_4", "test_5"),
   kindom = c("Plantae", "Plantae", "Animalia", "Animalia", "Plantae"),
  .bdc_scientificName_empty = c(TRUE, TRUE, TRUE, FALSE, FALSE),
  .bdc_coordinates_empty = c(TRUE, FALSE, FALSE, FALSE, FALSE),
  .bdc_coordinates_outOfRange = c(TRUE, FALSE, FALSE, FALSE, FALSE),
  .summary = c(TRUE, FALSE, FALSE, FALSE, FALSE)
)

bdc_filter_out_flags(
  data = x,
  col_to_remove = "all"
)
#> 
#> bdc_fiter_out_flags:
#> The following columns were removed from the database:
#> .bdc_scientificName_empty, .bdc_coordinates_empty, .bdc_coordinates_outOfRange, .summary
#>   database_id   kindom
#> 1      test_1  Plantae
#> 2      test_2  Plantae
#> 3      test_3 Animalia
#> 4      test_4 Animalia
#> 5      test_5  Plantae