webchem icon indicating copy to clipboard operation
webchem copied to clipboard

Check for possible edge case in `bcpc_query()`

Open Aariq opened this issue 3 years ago • 2 comments
trafficstars

@jranke fixed the way bcpc_query() parses activities and sub-activities in #348, #349 (thank you!). I think the fix relies on their always being one sub-activity for every activity, so we should look for any cases where activities have multiple sub-activities and add a test.

It may be best to just re-work the output to be a tibble (something that might be good to do anyways, #218).

Aariq avatar Feb 15 '22 19:02 Aariq

I hope I'm now using the most recent version of the function.. Is this an example for the situation you mentioned @Aariq?

webchem::bcpc_query("silica gel")[[1]][c("activity", "subactivity")]
#> $activity
#> [1] "insecticides"
#> 
#> $subactivity
#> [1] "desiccant insecticides; inorganic insecticides"

Created on 2022-02-16 by the reprex package (v2.0.1)

stitam avatar Feb 16 '22 07:02 stitam

Exactly. So it looks like it's not "broken"—the activity and subactivity vectors will be the same length—but could be better as a tibble.

Aariq avatar Feb 16 '22 14:02 Aariq