This function fetches data from Macrostrat via the Application Programming Interface (API). This is the core function for handling user requests.
GET_macrostrat(endpoint, query = list(), format = "json", output = "df")
A data.frame
(if format
is "csv" or "json" and output
is "df"), a list
(if format
is "json" and output
is "list"), or
sf
object (if format
is "geojson").
character
. The API endpoint to retrieve data from
Macrostrat.
character
. The API query to retrieve data from
Macrostrat.
character
. The format that data should be downloaded in.
Either: "csv", "json" (the default), or "geojson".
character
. If format
is "json", what format
should the output be in? Valid options are "list" (the default) or "df"
(data.frame). If "df" is chosen, all metadata will be lost.