-
Notifications
You must be signed in to change notification settings - Fork 383
Issues when rendering anova code in Quarto #13511
Replies: 1 comment · 3 replies
-
First, I took the liberty of editing your post to format correctly. Please see the edit and look how I am including more backticks around code (https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) Then, I think we'll need to have a full reproducible example. If you can make it minimal that is better.
![]() So there must be something inside your document that triggers this error. Without this document, we can't help |
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks. I tested your anova code in my document and got the same error. However, when testing the same code in a new document (and using the same packages) I do not get the error... So yes, it sounds like you are right about your assumption that something in the document triggers it. From what I can see, I cannot enclose either an R code or Quarto document so here is the entire code below: `title: "2_3 condition study"
|
Beta Was this translation helpful? Give feedback.
All reactions
-
@Marie-Pedersen-PhD-student please follow the guidelines about formatting that was already shared before. Could you properly format your post using code blocks for code and terminal outputs? Thanks. Additionally, there is unfortunately no way to provide you any help with a document that big.
Repeat this until you get a document of less than few hundreds lines. |
Beta Was this translation helpful? Give feedback.
All reactions
-
As the error is at the Reader step in Pandoc, you can also set Few tips:
Looking at this intermediate .md file may help see the syntax part that make the reader fails. However, the document you shared is quite useful and gives us some hint. (so yes please to format it correctly next time, now that you know how). If we look at the error
This is something about reading the .md file by Pandoc. As the issue mentions YAML, it may be something related to YAML block not being correctly parsed. So check you YAML block. Especially after your block that loads library, you have a if you want a horizontal rule, you need to add news lines around. Otherwise it could be parsed a start of YAML block And it could be related to anova because the ```
Analysis of Variance Table
Model 1: y ~ x1
Model 2: y ~ x1 + x2
Res.Df RSS Df Sum of Sq F Pr(>F)
1 98 932.12
2 97 87.78 1 844.34 933.01 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
``` It should be inside a codeblock syntax so I am surprised, but that could be the cause Here is a reproducible example to illustrate ---
title: "Anova test"
date: 2022-09-12
format: html
keep-md: true
---
```{r}
knitr::opts_chunk$set(echo = FALSE, message = TRUE, warning = FALSE)
```
---
# Anova test
```{r}
# Create a simple dataset
set.seed(123)
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- 2*x1 + 3*x2 + rnorm(100)
data <- data.frame(y = y, x1 = x1, x2 = x2)
# Fit two nested models
model1 <- lm(y ~ x1, data = data)
model2 <- lm(y ~ x1 + x2, data = data)
# Compare the models using anova()
anova(model1, model2)
``` leads to
commenting So now you know what to modify
Thanks again for sharing the doc, that was useful ! BTW in future version of quarto, we'll have a new reader that should warn you about those missing space and unnexpected parsing. Hope it was clear. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I keep getting the error message below if I include a simple anova code like this:
error message when rendering with an anova code like the one above:
Error running Lua:
YAML parse exception at line 4, column 2:
mapping values are not allowed in this context
stack traceback:
/Applications/quarto/share/pandoc/datadir/readqmd.lua:170: in function 'readqmd.readqmd'
/Applications/quarto/share/filters/qmd-reader.lua:13: in function 'Reader'
As soon as I remove anova I do not get any error. I have tried with various different anovas in different documents and got the same warning.
FYI the top of my document looks like this:
and I am utilizing these packages in my document:
I hope you can help me figure out what happens and how to solve it so I also can report my anova results.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions