@wch I think it would be slightly nicer to do:

```R
needs_install <- function(pkg, compare, version) {
  if (length(find.package(pkg, quiet = TRUE)) == 0) return(TRUE)
  if (is.na(compare)) return(FALSE)

  compare <- match.fun(compare)
  compare(packageVersion(pkg), version)
}
```