ropensci/webchem

In bcpc_query, the case of more than one activity is not properly handled

jranke opened this issue · 1 comments

Many active substance have more than one activity type in the BCPC. For example, 2,4-D is classified as herbicide and plant growth regulator.

webchem::bcpc_query("2,4-D")[[1]][c("activity", "subactivity")]
#> $activity
#> [1] "herbicides (phenoxyacetic herbicides)plant growth regulators"
#> 
#> $subactivity
#> [1] "auxins"

Created on 2022-01-31 by the reprex package (v2.0.1)

The HTML for this from https://pesticidecompendium.bcpc.org/2,4-d.html is

<td headers="r7">herbicides (<a href="class_herbicides.html#phenoxyacetic_herbicides" target="_top">phenoxyacetic herbicides</a>)<br>plant growth regulators (<a href="class_plant_growth_regulators.html#auxins" target="_top">auxins</a>)</td>

showing that the respective field has to be split by <br> before splitting into activity and subactivity.

Addendum, I noticed that in some cases, one of the subactivities can be empty (e.g. copper hydroxyde) and in at least one case (ziram) there are three different activities.