clean: clean Neotoma objects to remove duplicates and empty objects.

View source: R/clean.R

cleanR Documentation

clean Neotoma objects to remove duplicates and empty objects.

Description

Function that removes duplicate objects such as sites, datasets, or collection units. When we pull in a large number of objects, or overlapping searches, we can run into a problem where we have multiple instances of the same site, but with different datasets. This function attempts to gather all objects together:

  • Before: {site: 1, dataset: 1}, {site: 1, dataset: 2}

  • After: {site: 1, dataset: [1, 2]} So the site is gathered, and the datasets are now part of an array of datasets.

Usage

clean(x = NA, verbose = TRUE, ...)

Arguments

x

sites, datasets, collunits that may have duplicates.

verbose

parameter to prints out progress bar

...

Additional parameters associated with the call.

Value

clean neotoma objects without duplicates after concatenation

Author(s)

Simon Goring goring@wisc.edu

Examples


clean_sites <- get_sites(sitename = "L%", limit = 20)
more_sites <- get_sites(sitename = "La%", limit = 20)
long_set <- c(clean_sites, more_sites)
length(long_set)
# By removing duplicates we get a smaller object.
length(clean(long_set))
# We can do the same thing with collection units:
clean_cols <- get_sites(sitename = "L%", limit = 20) %>%
  collunits()
more_cols <- get_sites(sitename = "La%", limit = 20) %>%
  collunits()
long_set <- c(clean_cols, more_cols)
length(long_set)
# By removing duplicates we get a smaller object.
length(clean(long_set))
# And datasets:
clean_ds <- get_sites(sitename = "L%", limit = 20) %>%
  get_downloads() %>% datasets()
more_ds <- get_sites(sitename = "La%", limit = 20) %>%
  get_downloads() %>% datasets()
long_set <- c(clean_ds, more_ds)
length(long_set)
# By removing duplicates we get a smaller object.
length(clean(long_set))


neotoma2 documentation built on July 9, 2023, 7:37 p.m.