Skip to contents

axecute() creates a log, executes a file, and returns 0 if there are no errors or 1 if there are any errors

Usage

axecute(
  file,
  log_name = NA,
  log_path = NA,
  include_rds = FALSE,
  quit_on_error = TRUE,
  to_report = c("messages", "output", "result"),
  show_repo_url = FALSE,
  ...
)

Arguments

file

String. Path to file to execute

log_name

String. Name of log file

log_path

String. Path to log file

include_rds

Boolean. Option to export log object as Rds file. Defaults to FALSE

quit_on_error

Boolean. Should the session quit with status 1 on error? Defaults to TRUE

to_report

String vector. Objects to optionally report, may include as many as necessary:

  • messages: any messages generated by program execution

  • output: any output generated by program execution

  • result: any result generated by program execution

show_repo_url

Boolean. Should the repository URLs be reported Defaults to FALSE

...

Not used

Value

0 if there are no errors or 1 if there are any errors

Examples

dir <- tempdir()
text <- 'print("Hello, logrxperson!")'
fileConn <- file(file.path(dir, "hello.R"))
writeLines(text, fileConn)
close(fileConn)

axecute(file.path(dir, "hello.R"))
#> [1] "Hello, logrxperson!"


fileConn <- file(file.path(dir, "hello.Rmd"))
writeLines(text, fileConn)
close(fileConn)

axecute(file.path(dir, "hello.Rmd"))
#> 
#> 
#> processing file: hello.Rmd
#> 1/1
#> output file: hello.knit.md
#> /usr/bin/pandoc +RTS -K512m -RTS hello.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output hello.html --lua-filter /home/runner/work/_temp/Library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/runner/work/_temp/Library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /home/runner/work/_temp/Library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpuK3f2U/rmarkdown-strb05a6d05845a.html 
#> 
#> Output created: hello.html
#> 
#> 
#> processing file: /tmp/RtmpuK3f2U/hello.Rmd
#> 1/1
#> output file: /tmp/RtmpuK3f2U/fileb05a1590d0c3.R