elizagrames / litsearchr

litsearchr is an R package to partially automate search term selection for systematic reviews using keyword co-occurrence networks. In addition to identifying search terms, it can write Boolean searches and translate them into over 50 languages.
https://elizagrames.github.io/litsearchr
103 stars 26 forks source link

check_recall() similarity column is character #48

Open luketudge opened 4 years ago

luketudge commented 4 years ago

The return value of check_recall() is a character matrix. It would be nice to return the Similarity column as numeric in case the user wants to work with the values. This doesn't work right out of the box at the moment:

hits <- check_recall(
  true_hits = c("Picoides arcticus"),
  retrieved = c("Picoides tridactylus", "Seiurus aurocapilla")
)
1 - hits[, "Similarity]
Error in 1 - hits[, "Similarity"] : non-numeric argument to binary operator
class(hits[, "Similarity"])
[1] "character"

This occurs because cbind() on line 558 of write_scrape_test_searches.R by default coerces everything to the same type. It could be fixed by returning a dataframe instead of a cbind() matrix.