Hi all,
This is my first post to this community so I hope I get the format of my question correct.
I have successfully in the past used the render_book command in an Rscript, but today this script is throwing an error about the input file not being found.
For example, the name of the bookdown file I am working on is BasicWebsite.Rmd which lives in a source-posts folder located at home/source-posts
I have an R-Script that lives in the folder home and is shown below:
file_to_render <- "BasicWebsite"
library(bookdown)
render_book(
input = "./source-posts",
output_format = c("bookdown::html_book"),
output_dir = "../output/posts",
output_file = paste0(file_to_render),
envir = parent.frame(),
output_yaml= "_output.yml",
config_file= "_bookdown.yml",
quiet = FALSE,
encoding = "UTF-8"
)
I understand for bookdown that I need the files index.Rmd, _bookdown.yml, and _output.yml which are copied here respectively as
title: ""
site: bookdown::bookdown_site
link-citations: yes
and
rmd_files: "BasicWebsite.Rmd"
delete_merged_file: yes
and
bookdown::html_book:
css: styles.css
split_by: "rmd"
theme: cosmo
number_sections: no
toc: no
(P.S. I am using html_book rather than html_document2 as html_document2 does not seem to respect writing to the output_dir location specified in the render_book script)
Every time in the past I have run this render_book script an .html file is generated in an output folder specifically at home/output/posts/BasicWebsite.html
But today I get the error message:
render_book(
input = "./source-posts",
output_format = c("bookdown::html_book"),
output_dir = "../output/posts",
output_file = paste .... [TRUNCATED]
Error in stop_if_not_exists(input) :
Some files were not found: ./source-posts
I do not understand where I have gone wrong and why render_book is not finding the input file (BasicWebsite.Rmd) particularly when this script has behaved as expected so many times before.
My sessionInfo is
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: aarch64-apple-darwin21.3.0 (64-bit)
Running under: macOS Monterey 12.4
other attached packages:
[1] bookdown_0.27
loaded via a namespace (and not attached):
[1] compiler_4.2.0 fastmap_1.1.0 htmltools_0.5.2 tools_4.2.0 yaml_2.3.5
[6] rmarkdown_2.14 knitr_1.39 digest_0.6.29 xfun_0.31 rlang_1.0.2
[11] evaluate_0.15