5,391 questions
1
vote
1
answer
54
views
Plot shown in exams2html but not exams2pdf
Overview:
With my R/exams exercise provided below I have the problem that the plot output from my figure chunk is included correctly in the HTML output from exams2html() but it is dropped silently in ...
1
vote
1
answer
102
views
Rmarkdown: Show Warnings in the console but not the rendered document
Suppose I have the following RMarkdown document:
warnings.Rmd
---
title: "Warnings"
output: html_document
---
```{r include = FALSE, warning = FALSE}
warning("warning 1")
```
```{...
0
votes
0
answers
54
views
Define a new figure option for name of source file
In a book I have many figures and many R scripts producing them. It's a pain to go back and find the source file when I'm editing the text and need to change an example.
I'd like to define a new chunk ...
5
votes
1
answer
81
views
Is it possible to have some external files in an RMarkdown html document with self_contained = yes?
I have an rmarkdown project that produces a lot of interactive plotly plots that can switch among multiple json data sources and I'm running into the problem that the html file is getting very large ...
1
vote
0
answers
50
views
knitr: Set default format for external image files (like with auto_pdf option)
Is there a way to set the default graphics format for files given to knitr's include_graphics() function?
Its auto_pdf = TRUE is close to what I want (i.e. it chooses PDF files over files with ...
1
vote
1
answer
52
views
Markdown render() fails to print GT (or Kable) tables from embedded function
I am trying to print twice using gt from a function defined in a RMarkdown document. Here is my example code:
---
title: "illustrate problem"
output: html_document
---
Define a short ...
1
vote
0
answers
88
views
No image in RStudio with knitr
I have the following R markdown snippet:
---
title: "testing"
author: "jan"
date: "10/06/2025"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$...
5
votes
1
answer
102
views
Why is knitr failing to see a function defined in a child document?
I am working with Rmarkdown parent and child files, and using a YAML header to make it so that when I click "Knit" in RStudio on a child document, it compiles the parent (as seen here: https:...
6
votes
1
answer
125
views
Can I retrieve the label of an Rmd chunk both during knitting and interactively?
In this minimal example we can see that when knitting I will get the output "my-chunk-label". However, if we use "Run Current Chunk" (i.e. green chunk play button in RStudio) the ...
0
votes
0
answers
54
views
How do I knit in Rstudio correctly?
The code below runs smoothly in R but as soon as I try to knit to pdf there is an error.
A file that is clearly in my file library, suddenly can't be read.
(library("seqinr")
read.alignment(&...
4
votes
1
answer
151
views
Unclosed sink from knitr after setTimeLimit
Overview: I'm running knitr on a large number of R/Markdown files (actually R/exams exercises to be more specific), some of which take too long to complete. Hence I want to set a time limit for this ...
0
votes
0
answers
263
views
Why does my Quarto document produce a 404 error for R plots when I render?
I'm working on a Quarto project in VS code with a .qmd file ("01_data_exploration.qmd") that includes a ggplot2 plot. The plot displays correctly in an interactive R session, but when I ...
1
vote
0
answers
136
views
Rmarkdown is not running in VSCode
I am migrating from RStudion to VS Code. When I try to knit my .rmd files in VSCode, I it is stuck on 0%. However, when I write out the rmarkdown::render("") command manually in the R ...
1
vote
1
answer
92
views
What is a foolproof way of determining if a function is being called from within rmarkdown or quarto
I have a function that I want to have different behaviour based on if it is within a quarto document or a markdown document. I don't have access to the file extension of the document the function is ...
0
votes
1
answer
76
views
Construct output file name for RStudio knitr button using YAML header
I am using RStudio to generate documents using R markdown and knitr. I would like to specify the output file name dynamically based on the parameters in the YAML. This basic header works:
---
params:
...
3
votes
1
answer
88
views
Knitr not printining the plots in a loop
I'm using Knitr to generate a PDF report, where each page is dynamically created in a loop, displaying plots and tables side by side. The approach works well for tables, but the plots fail to appear ...
0
votes
0
answers
23
views
What does this kmeans error mean upon knitting?
I am working with a data set that has 93 observations and 17 all numeric variables. My kmeans function runs just fine in R until I try to knit it.
set.seed(2025)
km.out <- kmeans(cluster_dataset, ...
0
votes
0
answers
65
views
Printing multiples table and plots side by side with multicol in PDF Knit loop
I’m working on an R Markdown project and I’m having trouble getting my plots to show up where I want them in the document.
I need to create a loop that prints 3 tables (using kableExtra) and 3 plots (...
0
votes
1
answer
116
views
Pandoc adding line break tags to HTML Table Code
I am using Rmarkdown and Pandoc with a custom template to make a report where I have a table showing the users who have approved the content of a report. In my template, I've put this signature block ...
0
votes
0
answers
32
views
How to crop pdf while knitting rmd
I'm trying to generate a PDF table using kableExtra in R Markdown where the output PDF dimensions exactly match the table dimensions (no extra white space, no extra text, no page number, nothing else)....
0
votes
1
answer
331
views
gt_summary table not being correctly displayed after knitted to PDF format in R-Markdown (wrong order)
I am trying to write a report using R-Markdown and tables made with gt_summary but when i export to pdf format, something goes wrong and the table shows up before even the title.
I knitted do html ...
0
votes
0
answers
11
views
Issue with knitr being stuck while integrating Azure chatbot responses in Rmd to PDF rendering
I'm using the R package elmer, specifically the chat_azure function, to connect to the
Azure chatbot. The connection and message exchange works perfectly in R. However, I'm
facing an issue when I try ...
2
votes
0
answers
45
views
Stargazer Table Causes PDF Knit Error: '! You can't use `\relax' after \the [closed]
I'm encountering an error when knitting my R Markdown file to a PDF. The error message is as follows:
! You can't use `\relax' after \the.
<recently read> ...ort/tbl/leaders/begin_args_int
...
2
votes
1
answer
59
views
How can I get the "smooth=FALSE" argument in rgl to work in RMarkdown?
When I make a checkered surface by setting smooth=FALSE in the rgl package in R, it appears correctly in my computer's rgl window, but not in knitted R Markdown documents nor in the RStudio viewer, ...
1
vote
0
answers
121
views
How to start R Markdown HTML section numbering not at 1
I am working in an R Markdown document. I am using the standard markdown headings (e.g. # First Heading) and using the
output:
html_document:
number_sections: true
option in my YAML header to ...