R/r_path.R

Defines functions rscript_path r_path

Documented in r_path rscript_path

#' r_path
#'
#' @return System's path to R.exe
#' @export
r_path <- function(){
  r_bin <- R.home("bin")
  if("R.exe" %in% list.files(r_bin)){
    return(file.path(r_bin,"R.exe"))

  }else if("R" %in% list.files(r_bin)){
    return(file.path(r_bin,"R"))

  }
  stop("R.exe not found.")

}

#' rscript_path
#'
#' @return System's path to Rscript.exe
#' @export
rscript_path <- function(){
  r_bin <- R.home("bin")
  if("Rscript.exe" %in% list.files(r_bin)){
    return(file.path(r_bin,"Rscript.exe"))

  }else if("Rscript" %in% list.files(r_bin)){
    return(file.path(r_bin,"Rscript"))

  }
  stop("Rscript.exe not found.")

}
trevorlolsen/jobsR documentation built on Dec. 23, 2021, 12:56 p.m.