I would recommend having one input parameter regionsearch_region or some such, which then checks the class of the input (is it bbox, woeid, sp or sf?) and then:
For bbox, set bbox = the character string of the input bbox and woeid = NULL
For woeid, set woeid = input and bbox = NULL
For sp, sf, calculate the bounding box, convert to character and set it as bbox. woeid = NULL.
For sp/sf, at the end you can crop the points by the input sp, sf and return as an sp/sf object.
I would recommend having one input parameter
region
search_region
or some such, which then checks the class of the input (is itbbox
,woeid
,sp
orsf
?) and then:For
bbox
, setbbox =
the character string of the input bbox andwoeid = NULL
Forwoeid
, setwoeid =
input andbbox = NULL
Forsp
,sf
, calculate the bounding box, convert to character and set it asbbox
.woeid = NULL
.For
sp
/sf
, at the end you can crop the points by the inputsp
,sf
and return as ansp
/sf
object.