-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make more generalized function get_ember_data
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#' Get Ember-climate data from API | ||
#' @param dataset Dataset to retrieve. Default = "electricity-generation". Other options are "power-sector-emissions", "electricity-demand", and "carbon-intensity" | ||
#' @param temporal_resolution "yearly" (default) or "monthly" | ||
#' @param min_date Mininum date to retrieve data for. YYYY or YYYY-MM format. Default=2015 | ||
#' @param max_date Maximum date to retrieve data for. YYYY or YYYY-MM format. Default=2023 | ||
#' @param entity List of comma-separated country(s) or region(s) to return data for. Default is all (no filter) | ||
#' @param api_key Default is Sys.getenv("EMBER_API_KEY") | ||
#' @returns df Dataframe of requested data | ||
#' @export | ||
#' @seealso [get_ember_options()] | ||
|
||
get_ember_data <- function(dataset = "electricity-generation", | ||
temporal_resolution = "yearly", | ||
min_date = "2015", | ||
max_date = "2023", | ||
entity = "all", | ||
api_key = Sys.getenv("EMBER_API_KEY")) { | ||
|
||
query_url <- construct_query_url(endpoint = dataset, temporal_resolution, | ||
min_date, max_date, entity, api_key) | ||
|
||
df <- get_api_request(query_url) | ||
|
||
return(df) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.