Skip to content
Snippets Groups Projects
Commit bfbf631c authored by arsenij.ustjanzew's avatar arsenij.ustjanzew
Browse files

small fix to overwrite the .Object@file slot only if the file parameter was not provided.

parent 8958a7d6
No related branches found
No related tags found
2 merge requests!8Vignette: i2dash introduction,!4Filename fix
Pipeline #113394 passed
......@@ -5,11 +5,13 @@
#' @slot interactive If a shiny-based report should be created
#' @slot theme The theme of the dashboard
#' @slot datadir Path to the directory, where report data is stored.
#' @slot file Filename of the resulting report Rmd file.
#' @slot file The output filename (recommend that the suffix should be '.Rmd').
#' @slot pages A list of dashboard pages
#' @slot sidebar Content of the global sidebar
#' @slot colormaps A named list with color mappings.
#'
#' @return An i2dashboard object.
#'
#' @name idashboard-class
#' @rdname idashboard-class
#' @exportClass i2dashboard
......@@ -43,7 +45,7 @@ setMethod("initialize", "i2dashboard", function(.Object, ...) {
.Object <- callNextMethod()
# Create nice filename from title
if(!is.null(.Object@title)) {
if(is.null(.Object@file) & !is.null(.Object@title)) {
.Object@title %>% tolower %>% gsub(pattern = " ", replacement = "-") %>% gsub(pattern = '[^a-zA-Z0-9-]', replacement = '') %>% paste0(".Rmd") -> .Object@file
}
......
......@@ -12,6 +12,9 @@
i2dashboard(...)
}
\value{
An i2dashboard object.
}
\description{
The idashboard S4 class.
......@@ -34,7 +37,7 @@ Create a new i2dashboard object.
\item{\code{datadir}}{Path to the directory, where report data is stored.}
\item{\code{file}}{Filename of the resulting report Rmd file.}
\item{\code{file}}{The output filename (recommend that the suffix should be '.Rmd').}
\item{\code{pages}}{A list of dashboard pages}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment