It might be nice to let users specify whether or not to print the map. We could use an option, e.g. options(yelpr.show_map = FALSE). Then, the print method would look something like this, where show_map = getOption("yelpr.show_map") is an argument that gets checked before printing the map:
print.business_tbl <- function(x, ..., view = interactive(), show_map = getOption("yelpr.show_map")) {
# not totally sure about this condition. `getOption()` returns `NULL` if nothing is set.
if (isTRUE(show_map) || is.null(show_map)) {
# ...code to print leaflet map
}
NextMethod()
}
If we add this, we should probably document it in yelp_search() since most people don't look at print() method documentation.
Oh that's perfect! I spent the last week trying to rewrite yelp_search so that if print = TRUE it would print the map, but this is a much more succinct way.
It might be nice to let users specify whether or not to print the map. We could use an option, e.g.
options(yelpr.show_map = FALSE)
. Then, the print method would look something like this, whereshow_map = getOption("yelpr.show_map")
is an argument that gets checked before printing the map:If we add this, we should probably document it in
yelp_search()
since most people don't look atprint()
method documentation.