Skip to content

Commit

Permalink
fix bug in rendering script for nash analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Dec 12, 2023
1 parent 33542c7 commit f62388d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
1 change: 1 addition & 0 deletions .buildlibrary
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ AcceptedNotes:
- Imports includes .* non-default packages.
- unable to verify current time
- checking installed package size
- Namespace in Imports field not imported from: ‘htmltools’
AutocreateReadme: yes
allowLinterWarnings: yes
28 changes: 15 additions & 13 deletions R/nashAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@
#'
#' @author Falk Benke
#'
#' @param gdx file path to a gdx file (default fulldata.gdx)
#' @param outputFile file name to save the html dashboard
#' @param gdx a GDX object as created by readGDX, or the path to a gdx
#' @param outputDir \code{character(1)}. The directory where the output document
#' and intermediary files are created.
#' @param outputFile \code{character(1)}. File name (without extension) of the
#' output document to be created.
#' @return The value returned by \code{\link[rmarkdown:render]{rmarkdown::render()}}.
#'
#' @importFrom rmarkdown render
#'
#' @export
nashAnalysis <- function(gdx = "fulldata.gdx", outputFile = NULL) {
nashAnalysis <- function(gdx = "fulldata.gdx", outputDir = getwd(), outputFile = "Nash Analysis.html") {

if (!file.exists(gdx)) {
warning("Gdx file not found.")
return()
}

markdownPath <- system.file("markdown", "nashAnalysis.Rmd", package = "remind2")
yamlParams <- list(gdx = normalizePath(gdx, mustWork = TRUE))

if (is.null(outputFile)) {
outputFile <- file.path(getwd(), "Nash Analysis.html")
}

rmarkdown::render(markdownPath, output_file = outputFile, params = list(gdx = gdx))
rmarkdown::render(
system.file("markdown", "nashAnalysis.Rmd", package = "remind2"),
output_dir = outputDir,
output_file = outputFile,
output_format = "html_document",
params = yamlParams
)
}
17 changes: 14 additions & 3 deletions man/nashAnalysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f62388d

Please sign in to comment.