Closed kamapu closed 4 years ago
Enhancement implemented at https://github.com/ropensci/taxlist/commit/ae646e02be368a532535da198efd5c04a4daa054
The cited task can be achieved with dissect_name()
only:
# Data frame
Data <- data.frame( GenusSpecies=c("Acer platanoides - bla bla", " Acer platanoides Miguel ", "Acer platanifolius ble"), n=1)
# Get rid of leading, trailing and double blanks
Data$GenusSpecies <- clean_strings(Data$GenusSpecies)
# New version
Data$new_name <- dissect_name(Data$GenusSpecies, repaste=c(1:2))
# Statistics
Stats <- aggregate(n ~ new_name, Data, sum)
Through an example in Facebook I realized that in many cases, the function
dissect_name()
can be required to extract more than a single element as a single character value, as in this example.To simplify the third command, a new argument repaste will be implemented in this function.