Skip to content

Commit

Permalink
Change example so user can run directly
Browse files Browse the repository at this point in the history
  • Loading branch information
arni-magnusson committed Mar 27, 2023
1 parent 3eed01e commit 6a52a61
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
26 changes: 21 additions & 5 deletions R/make.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,41 @@
#' \code{\link{source}} is the underlying function to run a script.
#'
#' @examples
#' \dontrun{
#' \donttest{
#' # Copy examples 'analysis' and 'sequential' to temporary directory
#' exdir <- tempdir()
#' file.copy(system.file("examples/analysis", package="makeit"),
#' exdir, recursive=TRUE)
#' file.copy(system.file("examples/sequential", package="makeit"),
#' exdir, recursive=TRUE)
#' owd <- getwd()
#'
#' # Here, analysis.R uses input.dat, creating output.dat
#' setwd(file.path(exdir, "analysis"))
#' dir()
#' make("analysis.R", "input.dat", "output.dat") # Running analysis.R
#' dir()
#' make("analysis.R", "input.dat", "output.dat") # Nothing to be done
#'
#' # Suppress messages, show last modified
#' # Suppress message, show last modified
#' make("analysis.R", "input.dat", "output.dat", silent=TRUE)
#' make("analysis.R", "input.dat", "output.dat", details=TRUE)
#'
#' # Sequential scripts
#' setwd(file.path(exdir, "sequential"))
#' print.simple.list(dir(recursive=TRUE))
#' make("01_model.R", "data.dat", "results.dat")
#' make("02_plots.R", "results.dat", c("plots/A.png", "plots/B.png"))
#' make("03_tables.R", "results.dat", c("tables/A.csv", "tables/B.csv"))
#' print.simple.list(dir(recursive=TRUE))
#'
#' # Copy these to working directories and explore
#' system.file("examples/analysis", package="makeit")
#' system.file("examples/sequential", package="makeit")
#' # Clean up
#' unlink(file.path(exdir, c("analysis", "sequential")), recursive=TRUE)
#' setwd(owd)
#' }
#'
#' @aliases makeit
#'
#' @export

make <- function(recipe, prereq, target, include=TRUE, details=FALSE,
Expand Down
25 changes: 20 additions & 5 deletions man/make.Rd

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

0 comments on commit 6a52a61

Please sign in to comment.