From 1a0858c3ec782fecf415deb36e797407528c45e4 Mon Sep 17 00:00:00 2001 From: berthetclement Date: Fri, 29 Nov 2024 11:17:18 +0100 Subject: [PATCH] exchangesStack() documentation example updated + cran comments + news --- NEWS.md | 3 +- R/stack_exchanges.R | 86 +++++++++++++++++++++---------------------- cran-comments.md | 12 +++++- man/exchangesStack.Rd | 84 ++++++++++++++++++++---------------------- 4 files changed, 94 insertions(+), 91 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3322789..c8ac011 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,8 @@ Copyright 2016 RTE Reseau de transport d'electricite # antaresViz 0.18.3 * The package has been accepted but archived as version 0.18.2. -New version for distribution on CRAN +New version for distribution on CRAN +* Licence file updated and documentation for `exchangesStack()` updated # antaresViz 0.18.2 * fix cran issue on test not skip well diff --git a/R/stack_exchanges.R b/R/stack_exchanges.R index 8d4ff3a..b23b9e9 100644 --- a/R/stack_exchanges.R +++ b/R/stack_exchanges.R @@ -1,8 +1,8 @@ # Copyright © 2016 RTE Réseau de transport d’électricité -#' Plot the exchanges of an area +#' @title Plot the exchanges of an area #' -#' This function draws a stack representing the evolution of the exchanges of +#' @description This function draws a stack representing the evolution of the exchanges of #' an area with its neighbours. Positive values denotes exports and negative #' values imports. #' User can either plot all flows from/to an area using the \code{default} stack or use a custom one. @@ -46,50 +46,46 @@ #' } #' #' @examples -#' \dontrun{ -#' mydata <- readAntares(links = "all", timeStep = "daily") -#' exchangesStack(mydata) -#' -#' # Also display exchanges with the rest of the world -#' mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") -#' exchangesStack(mydata) -#' -#' # Use compare : -#' exchangesStack(mydata, compare = "mcYear") -#' exchangesStack(mydata, compare = "area") -#' exchangesStack(mydata, compare = "unit") -#' exchangesStack(mydata, compare = "legend") -#' # Compare studies with refStudy argument -#' exchangesStack(x = myData1, refStudy = myData2) -#' exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) -#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) -#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) -#' -#' # Use h5 opts -#' # Set path of simulaiton -#' setSimulationPath(path = path1) -#' -#' # Convert your study in h5 format -#' writeAntaresH5(path = mynewpath) -#' -#' # Redefine sim path with h5 file -#' opts <- setSimulationPath(path = mynewpath) -#' exchangesStack(x = opts) -#' -#' # Compare elements in a single study -#' exchangesStack(x = opts, .compare = "mcYear") -#' -#' # Compare 2 studies -#' exchangesStack(x = list(opts, opts2)) -#' -#' # Compare 2 studies with argument refStudy -#' exchangesStack(x = opts, refStudy = opts2) -#' exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -#' exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list( -#' areas = getAreas(select = "a"), -#' links = getLinks(areas = myArea), -#' mcYears = myMcYear)) +#' \donttest{ +#' library(antaresRead) +#' # with study test for example (study is in package antaresRead) +#' sourcedir <- system.file("testdata", package = "antaresRead") #' +#' # untar study in temp dir +#' path_latest <- file.path(tempdir(), "latest") +#' untar(file.path(sourcedir, "antares-test-study.tar.gz"), exdir = path_latest) +#' +#' study_path <- file.path(path_latest, "test_case") +#' +#' # set path to your Antares simulation +#' opts <- setSimulationPath(study_path) +#' +#' if(interactive()){ +#' mydata <- readAntares(links = "all", timeStep = "daily") +#' exchangesStack(mydata) +#' +#' # Also display exchanges with the rest of the world +#' mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") +#' exchangesStack(mydata) +#' +#' # Use compare : +#' exchangesStack(mydata, compare = "mcYear") +#' exchangesStack(mydata, compare = "area") +#' exchangesStack(mydata, compare = "unit") +#' exchangesStack(mydata, compare = "legend") +#' # Compare studies with refStudy argument +#' exchangesStack(x = myData1, refStudy = myData2) +#' exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) +#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) +#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) +#' +#' +#' # Compare 2 studies +#' exchangesStack(x = list(opts, opts)) +#' +#' # Compare 2 studies with argument refStudy +#' exchangesStack(x = opts, refStudy = opts) +#' } #' } #' #' @export diff --git a/cran-comments.md b/cran-comments.md index e0659dd..c613b10 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -32,5 +32,15 @@ We have to fix dependencies with package `rhdf5` on this package before to push Cran check in ERROR cause test skip not skip ## v0.18.3 -To put the package back on CRAN +To put the package back on CRAN + - `exchangesStack()` documentation updated with `\donttest` and rewrite example + - Update file "Licence" with GPL licence `usethis::use_gpl_license()` + +``` +> devtools::check_man() +ℹ Updating antaresViz documentation +ℹ Loading antaresViz +ℹ Checking documentation... +✔ No issues detected +``` diff --git a/man/exchangesStack.Rd b/man/exchangesStack.Rd index fd0dd06..43969f9 100644 --- a/man/exchangesStack.Rd +++ b/man/exchangesStack.Rd @@ -198,50 +198,46 @@ Compare argument can take following values : } } \examples{ -\dontrun{ -mydata <- readAntares(links = "all", timeStep = "daily") -exchangesStack(mydata) - -# Also display exchanges with the rest of the world -mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") -exchangesStack(mydata) - -# Use compare : -exchangesStack(mydata, compare = "mcYear") -exchangesStack(mydata, compare = "area") -exchangesStack(mydata, compare = "unit") -exchangesStack(mydata, compare = "legend") -# Compare studies with refStudy argument -exchangesStack(x = myData1, refStudy = myData2) -exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) - -# Use h5 opts -# Set path of simulaiton -setSimulationPath(path = path1) - -# Convert your study in h5 format -writeAntaresH5(path = mynewpath) - -# Redefine sim path with h5 file -opts <- setSimulationPath(path = mynewpath) -exchangesStack(x = opts) - -# Compare elements in a single study -exchangesStack(x = opts, .compare = "mcYear") - -# Compare 2 studies -exchangesStack(x = list(opts, opts2)) - -# Compare 2 studies with argument refStudy -exchangesStack(x = opts, refStudy = opts2) -exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list( -areas = getAreas(select = "a"), -links = getLinks(areas = myArea), -mcYears = myMcYear)) - +\donttest{ +library(antaresRead) +# with study test for example (study is in package antaresRead) +sourcedir <- system.file("testdata", package = "antaresRead") + +# untar study in temp dir +path_latest <- file.path(tempdir(), "latest") +untar(file.path(sourcedir, "antares-test-study.tar.gz"), exdir = path_latest) + +study_path <- file.path(path_latest, "test_case") + +# set path to your Antares simulation +opts <- setSimulationPath(study_path) + +if(interactive()){ + mydata <- readAntares(links = "all", timeStep = "daily") + exchangesStack(mydata) + + # Also display exchanges with the rest of the world + mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") + exchangesStack(mydata) + + # Use compare : + exchangesStack(mydata, compare = "mcYear") + exchangesStack(mydata, compare = "area") + exchangesStack(mydata, compare = "unit") + exchangesStack(mydata, compare = "legend") + # Compare studies with refStudy argument + exchangesStack(x = myData1, refStudy = myData2) + exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) + exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) + exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) + + + # Compare 2 studies + exchangesStack(x = list(opts, opts)) + + # Compare 2 studies with argument refStudy + exchangesStack(x = opts, refStudy = opts) +} } }