Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Mar 7, 2024
1 parent 07e4637 commit 590d8aa
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 44 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ importFrom(gplots,rich.colors)
importFrom(grid,grid.draw)
importFrom(grid,grid.newpage)
importFrom(pheatmap,pheatmap)
importFrom(rstudioapi,getSourceEditorContext)
importFrom(sessioninfo,session_info)
importFrom(sm,sm.density)
importFrom(vioplot,vioplot)
26 changes: 1 addition & 25 deletions R/MarkdownReports.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ utils::globalVariables(c(
#' b.png4Github = TRUE
#' )
setup_MarkdownReports <- function(OutDir = getwd(),
scriptname = .getScriptName(),
scriptname = CodeAndRoll2::getScriptName(),
title = "",
setDir = TRUE,
newName = NULL,
Expand Down Expand Up @@ -2662,30 +2662,6 @@ wLinRegression <- function(DF,
# ______________________________________________________________________________________________----
# Helpers ----
# _________________________________________________________________________________________________
#' @title Get Current Script Name or Basename of Output Directory
#'
#' @description This function attempts to retrieve the name of the currently opened script in
#' the RStudio editor. If the script name cannot be obtained or if the `rstudioapi` package is
#' not available, it returns the basename of the directory specified by `OutDir`.
#'
#' @return A string containing the basename of the current script or the basename of `OutDir`
#' if the script name is unavailable.
#' @importFrom rstudioapi getSourceEditorContext
.getScriptName <- function() {
# Check if rstudioapi is available
if (!requireNamespace("rstudioapi", quietly = TRUE)) {
message("rstudioapi package is not available. Please install it using install.packages('rstudioapi').")
} else {
scriptName <- basename(rstudioapi::getSourceEditorContext()$path)
}

# If scriptName is empty, return basename of OutDir
# Can happen at an unsaved file, etc.
if (scriptName == "") scriptName <- basename(OutDir)

return(scriptName)
}



# ______________________________________________________________________________________________----
Expand Down
17 changes: 0 additions & 17 deletions man/dot-getScriptName.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/setup_MarkdownReports.Rd

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

0 comments on commit 590d8aa

Please sign in to comment.