test/run_test.r

require(rmarkdown)

#------------------------------------------------------------------------------
#	Change working directory to package directory
#------------------------------------------------------------------------------
get.this.file.dir <- function() {
	cmdArgs <- commandArgs(trailingOnly = FALSE)
	needle <- "--file="
	match <- grep(needle, cmdArgs)
	if (length(match) > 0) {
		# Rscript
		return(dirname(sub(needle, "", cmdArgs[match])))
	} else {
		# 'source'd via R console
		return(dirname(normalizePath(sys.frames()[[1]]$ofile)))
	}
}

old.wd <- setwd(get.this.file.dir())

rmarkdown::render("../vignettes/visual.test.rmd")

setwd(old.wd)
rm(old.wd)
Marchen/partial.plot documentation built on Feb. 13, 2025, 4:18 a.m.