Skip to contents

Drop one or more rows from a taxonomic database in Darwin Core (DwC) format by taxonID or scientificName.

Usage

dct_drop_row(tax_dat, taxonID = NULL, scientificName = NULL)

Arguments

tax_dat

Dataframe; taxonomic database in DwC format.

taxonID

Character or numeric vector; taxonID of the row(s) to be dropped.

scientificName

Character vector; scientificName of the row(s) to be dropped.

Value

Dataframe; taxonomic database in DwC format

Details

Only works if values of taxonID or scientificName are unique and non-missing in the taxonomic database (tax_dat).

Either taxonID or scientificName should be provided, but not both.

Examples

# Can drop rows by scientificName or taxonID
dct_filmies |>
  dct_drop_row(scientificName = "Cephalomanes atrovirens Presl")
#> # A tibble: 2,450 × 5
#>    taxonID  acceptedNameUsageID taxonomicStatus taxonRank scientificName        
#>    <chr>    <chr>               <chr>           <chr>     <chr>                 
#>  1 54133783 54115097            synonym         species   Trichomanes crassum C…
#>  2 54115097 NA                  accepted        species   Cephalomanes crassum …
#>  3 54133784 54115098            synonym         species   Trichomanes densinerv…
#>  4 54115098 NA                  accepted        species   Cephalomanes densiner…
#>  5 54133786 54115100            synonym         species   Cephalomanes curvatum…
#>  6 54133787 54115100            synonym         species   Cephalomanes javanica…
#>  7 54133788 54115100            synonym         species   Cephalomanes oblongif…
#>  8 54133789 54115100            synonym         species   Cephalomanes zollinge…
#>  9 54133790 54115100            synonym         species   Lacostea javanica (Bl…
#> 10 54133791 54115100            synonym         species   Lacostea rhomboidea P…
#> # ℹ 2,440 more rows

dct_filmies |>
  dct_drop_row(taxonID = "54133783")
#> # A tibble: 2,450 × 5
#>    taxonID  acceptedNameUsageID taxonomicStatus taxonRank scientificName        
#>    <chr>    <chr>               <chr>           <chr>     <chr>                 
#>  1 54115096 NA                  accepted        species   Cephalomanes atrovire…
#>  2 54115097 NA                  accepted        species   Cephalomanes crassum …
#>  3 54133784 54115098            synonym         species   Trichomanes densinerv…
#>  4 54115098 NA                  accepted        species   Cephalomanes densiner…
#>  5 54133786 54115100            synonym         species   Cephalomanes curvatum…
#>  6 54133787 54115100            synonym         species   Cephalomanes javanica…
#>  7 54133788 54115100            synonym         species   Cephalomanes oblongif…
#>  8 54133789 54115100            synonym         species   Cephalomanes zollinge…
#>  9 54133790 54115100            synonym         species   Lacostea javanica (Bl…
#> 10 54133791 54115100            synonym         species   Lacostea rhomboidea P…
#> # ℹ 2,440 more rows

# Can drop multiple rows at once by providing multiple values for
# scientificName or taxonID
dct_filmies |>
  dct_drop_row(
    scientificName = c(
      "Cephalomanes atrovirens Presl",
      "Trichomanes crassum Copel."
    )
  )
#> # A tibble: 2,449 × 5
#>    taxonID  acceptedNameUsageID taxonomicStatus taxonRank scientificName        
#>    <chr>    <chr>               <chr>           <chr>     <chr>                 
#>  1 54115097 NA                  accepted        species   Cephalomanes crassum …
#>  2 54133784 54115098            synonym         species   Trichomanes densinerv…
#>  3 54115098 NA                  accepted        species   Cephalomanes densiner…
#>  4 54133786 54115100            synonym         species   Cephalomanes curvatum…
#>  5 54133787 54115100            synonym         species   Cephalomanes javanica…
#>  6 54133788 54115100            synonym         species   Cephalomanes oblongif…
#>  7 54133789 54115100            synonym         species   Cephalomanes zollinge…
#>  8 54133790 54115100            synonym         species   Lacostea javanica (Bl…
#>  9 54133791 54115100            synonym         species   Lacostea rhomboidea P…
#> 10 54133792 54115100            synonym         species   Lacostea zollingeri (…
#> # ℹ 2,439 more rows

dct_filmies |>
  dct_drop_row(
    taxonID = c(
      "54133783", "54133783"
    )
  )
#> # A tibble: 2,450 × 5
#>    taxonID  acceptedNameUsageID taxonomicStatus taxonRank scientificName        
#>    <chr>    <chr>               <chr>           <chr>     <chr>                 
#>  1 54115096 NA                  accepted        species   Cephalomanes atrovire…
#>  2 54115097 NA                  accepted        species   Cephalomanes crassum …
#>  3 54133784 54115098            synonym         species   Trichomanes densinerv…
#>  4 54115098 NA                  accepted        species   Cephalomanes densiner…
#>  5 54133786 54115100            synonym         species   Cephalomanes curvatum…
#>  6 54133787 54115100            synonym         species   Cephalomanes javanica…
#>  7 54133788 54115100            synonym         species   Cephalomanes oblongif…
#>  8 54133789 54115100            synonym         species   Cephalomanes zollinge…
#>  9 54133790 54115100            synonym         species   Lacostea javanica (Bl…
#> 10 54133791 54115100            synonym         species   Lacostea rhomboidea P…
#> # ℹ 2,440 more rows