Cannot knit the default markdown to html or pdf

Error in comment_chars[[engine]] %||% "#" :
could not find function "%||%"
Calls: ... partition_chunk -> -> get_option_comment
Execution halted

I'm having the exact same issues. Just updated R/Rstudio yesterday and haven't been able to Knit since. Have tried on the default markdown and another markdown.

R: 4.2.3
RStudio: 2024.04.1

Here's the traceback.

Error in comment_chars[[engine]] %||% "#" : 
  could not find function "%||%"
10.
get_option_comment(engine)
9.
xfun::divide_chunk(engine, code)
8.
partition_chunk(engine, code)
7.
parse_block(g[-1], g[1], params.src, markdown_mode)
6.
FUN(X[[i]], ...)
5.
lapply(seq_along(groups), function(i) {
knit_concord$set(block = i)
g = groups[[i]]
block = grepl(chunk.begin, g[1]) ...
4.
split_file(lines = text)
3.
process_file(text, output)
2.
knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
1.
render("a.Rmd")

@Sheep944 I found a solution. Apparently I had updated my R version (from R 4.2.3 to R 4.4.0), but didn't uninstall the old version, so RStudio was still using the older version of R. This version was incompatible with current package updates. Once I ensured RStudio was using the most up to date version of R (R 4.4.0) the issue resolved itself.

Hope that helps!

1 Like

Thank you. Sorry for the silly question, just wondering how you did this?

I'm sure there's a more formal way, but I just uninstalled the old version of R from my computer!