Hi, I'm currently running R scripts in scheduleR on a linux server, and writing the output to sql tables. I'm trying to get .Rmd scripts to run as well, but for unclear reasons, they are failing. My test .Rmd script works fine when running locally in Rstudio. Both html and pdf outputs have the same error. Does a server version of Rstudio need to be installed, or some additional packages required for rendering? I'm also wondering how to best define the output path. Am thinking initially, just direct the output doc to another folder in the repo. Does the rmarkdown library need to be called somewhere in the script when running in scheduleR ?
title: "Test of rmarkdown in scheduleR"
author: "Will Gilks"
date: "2023-10-04"
output: html_document
---
` ``{r setup1, include=FALSE}
# output: html_document
# RMARKDOWN_WRITE_PATH="~/Desktop/"
# knitr::opts_knit$set(root.dir=RMARKDOWN_WRITE_PATH)
knitr::opts_chunk$set(echo=FALSE)
renv::use(lockfile=Sys.getenv("R_LOCK"))
Sys.setenv(TZ="UTC")
library(tidyverse)
Quitting from lines 9-38 (test_rmarkdown.Rmd)
Error in if (source %in% c("git2r", "xgit")) source <- "git" :
argument is of length zero
Calls: <Anonymous> ... enumerate -> lapply -> FUN -> f -> renv_record_source_normalize
In addition: Warning message:
In do_once((if (is_R_CMD_check()) stop else warning)("The function xfun::isFALSE() will be deprecated in the future. Please ", :
The function xfun::isFALSE() will be deprecated in the future. Please consider using base::isFALSE(x) or identical(x, FALSE) instead.
Traceback (most recent calls last):
27: rmarkdown::render("code/scripts/data-science/daily/test_rmarkdown.Rmd",
"html_document")
26: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
25: process_file(text, output)
24: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
23: process_group(group)
22: process_group.block(group)
21: call_block(x)
20: block_exec(params)
19: eng_r(options)
18: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (is.numeric(options$error)) options$error else {
if (options$error && options$include)
0L
else 2L
}, output_handler = knit_handlers(options$render, options)))
17: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (is.numeric(options$error)) options$error else {
if (options$error && options$include)
0L
else 2L
}, output_handler = knit_handlers(options$render, options))
16: evaluate::evaluate(...)
15: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
14: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
13: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
12: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
11: withVisible(eval(expr, envir, enclos))
10: eval(expr, envir, enclos)
9: eval(expr, envir, enclos)
8: renv::use(lockfile = Sys.getenv("R_LOCK"))
7: restore(lockfile = lockfile, clean = FALSE)
6: renv_lockfile_repair(lockfile)
5: enumerate(records, function(package, record) {
source <- renv_record_source_normalize(record, record$Source)
if (identical(source, "Repository") && is.null(record$Version)) {
entry <- renv_available_packages_latest(package)
record$Version <- entry$Version
}
record
})
4: lapply(idx, callback)
3: FUN(X[[i]], ...)
2: f(n[[i]], x[[i]], ...)
1: renv_record_source_normalize(record, record$Source)
Execution halted