R/setwd_toSource.R

Defines functions setwd_toSource

Documented in setwd_toSource

#' This fucntion sets the working directory to the source file location, using
#' the RStudio API.
#' @return The working directory is printed to the console.
#' @export

setwd_toSource <- function() {
  currentPath = rstudioapi::getActiveDocumentContext()$path
  setwd(dirname(currentPath))
  rm(currentPath)
  getwd()
}
michaelasher/asherR documentation built on July 5, 2023, 8:55 p.m.