Skip to contents

This function attempts to split a scientific name into it's component pieces. Given an input scientific, or scientific with scientific authorities and infraspecies this function will parse them into the columns used in the BarnebyLives pipeline.

Usage

split_scientificName(x, sciName_col, overwrite)

Arguments

x

Dataframe with collection information.

sciName_col

Character. Column containing the data to parse

overwrite

Boolean. Whether to overwrite the original input columns, or simply append the spell checked columns.

Examples

library(BarnebyLives)
ce <- collection_examples
ce <- data.frame(
  Collection_number = ce$Collection_number[sample(1:nrow(ce), size = 100, replace = FALSE)],
  Binomial = c(ce$Full_name, ce$Name_authority)[sample(1:nrow(ce)*2, size = 100, replace = FALSE)],
  Binomial_authority = ce$Binomial_authority[sample(1:nrow(ce), size = 100, replace = FALSE)]
) # extra columns to challenge name search - values are meaningless

split_scientificName(ce)|> head()
#> `sciName_col` argument not supplied, using: Binomial
#>   Collection_number         x...sciName_col.       Genus    Epithet
#> 1              2880    Delphinium andersonii  Delphinium andersonii
#> 2              2833      Camissonia contorta  Camissonia   contorta
#> 3              2823           Diplacus nanus    Diplacus      nanus
#> 4              2923 Scutellaria nana A. Gray Scutellaria       nana
#> 5              2896 Festuca idahoensis Elmer     Festuca idahoensis
#> 6              2921  Allium acuminatum Hook.      Allium acuminatum
#>         Binomial_authority        Name_authority Infraspecific_rank
#> 1    Delphinium andersonii Delphinium andersonii               <NA>
#> 2      Camissonia contorta   Camissonia contorta               <NA>
#> 3           Diplacus nanus        Diplacus nanus               <NA>
#> 4 Scutellaria nana A. Gray               A. Gray               <NA>
#> 5 Festuca idahoensis Elmer                 Elmer               <NA>
#> 6  Allium acuminatum Hook.                 Hook.               <NA>
#>   Infraspecies Infraspecific_authority
#> 1         <NA>                    <NA>
#> 2         <NA>                    <NA>
#> 3         <NA>                    <NA>
#> 4         <NA>                    <NA>
#> 5         <NA>                    <NA>
#> 6         <NA>                    <NA>
split_scientificName(ce, sciName_col = 'Binomial') |> head()
#>   Collection_number         x...sciName_col.       Genus    Epithet
#> 1              2880    Delphinium andersonii  Delphinium andersonii
#> 2              2833      Camissonia contorta  Camissonia   contorta
#> 3              2823           Diplacus nanus    Diplacus      nanus
#> 4              2923 Scutellaria nana A. Gray Scutellaria       nana
#> 5              2896 Festuca idahoensis Elmer     Festuca idahoensis
#> 6              2921  Allium acuminatum Hook.      Allium acuminatum
#>         Binomial_authority        Name_authority Infraspecific_rank
#> 1    Delphinium andersonii Delphinium andersonii               <NA>
#> 2      Camissonia contorta   Camissonia contorta               <NA>
#> 3           Diplacus nanus        Diplacus nanus               <NA>
#> 4 Scutellaria nana A. Gray               A. Gray               <NA>
#> 5 Festuca idahoensis Elmer                 Elmer               <NA>
#> 6  Allium acuminatum Hook.                 Hook.               <NA>
#>   Infraspecies Infraspecific_authority
#> 1         <NA>                    <NA>
#> 2         <NA>                    <NA>
#> 3         <NA>                    <NA>
#> 4         <NA>                    <NA>
#> 5         <NA>                    <NA>
#> 6         <NA>                    <NA>