A convenience wrapper around dc_get_node()
to retrieve all available
entity classes in Data Commons. This is equivalent to calling dc_get_node()
with nodes = "Class"
and expression = "<-typeOf"
.
dc_get_classes(
api_key = Sys.getenv("DATACOMMONS_API_KEY"),
base_url = Sys.getenv("DATACOMMONS_BASE_URL", unset =
"https://api.datacommons.org/v2/"),
return_type = "json"
)
Your Data Commons API key. If not provided, will use the
environment variable DATACOMMONS_API_KEY
.
The base URL of the Data Commons API. Defaults to the public endpoint. For custom deployments, it must end with "/core/api/v2/".
Return format: either "list"
(parsed R object) or
"json"
(JSON string).
A list (if return_type = "list"
) or JSON string (if
return_type = "json"
) containing all available entity classes.
if (FALSE) { # dc_has_api_key()
# Get all entity classes
all_classes <- dc_get_classes(return_type = "json")
}