diff --git a/NAMESPACE b/NAMESPACE index 354367a..f000b9b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/MarkdownReports.R b/R/MarkdownReports.R index f25ff9c..04a567e 100644 --- a/R/MarkdownReports.R +++ b/R/MarkdownReports.R @@ -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, @@ -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) -} - # ______________________________________________________________________________________________---- diff --git a/man/dot-getScriptName.Rd b/man/dot-getScriptName.Rd deleted file mode 100644 index 9252d08..0000000 --- a/man/dot-getScriptName.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MarkdownReports.R -\name{.getScriptName} -\alias{.getScriptName} -\title{Get Current Script Name or Basename of Output Directory} -\usage{ -.getScriptName() -} -\value{ -A string containing the basename of the current script or the basename of \code{OutDir} -if the script name is unavailable. -} -\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 \code{rstudioapi} package is -not available, it returns the basename of the directory specified by \code{OutDir}. -} diff --git a/man/setup_MarkdownReports.Rd b/man/setup_MarkdownReports.Rd index d7fe6b8..3a36916 100644 --- a/man/setup_MarkdownReports.Rd +++ b/man/setup_MarkdownReports.Rd @@ -6,7 +6,7 @@ \usage{ setup_MarkdownReports( OutDir = getwd(), - scriptname = .getScriptName(), + scriptname = CodeAndRoll2::getScriptName(), title = "", setDir = TRUE, newName = NULL,