Skip to content

Error when makup = "latex" and "\\%" in the name of a summary row #113

@dewittpe

Description

@dewittpe

The following results in an error when passed to rmarkdown::render

---
title: "Untitled"
author: "TEST"
output:
  pdf_document: default
  bookdown::pdf_document2: null
---

```{r results = 'asis'}
library(qwraps2)
library(knitr)
library(kableExtra)

# Create som sample data
set.seed(2)
df <- data.frame(
  group = as.factor(sample(c("A","B"),8, replace = T)),
  value = sample(2:10,8, replace=F),
  pos = as.factor(sample(c("pos.","neg."),8, replace = T))
)

# Define the table for summary_table
summary <- list(
  "Groups" = list(
    "Value" = ~ median_iqr(value),
    "Pos. (\\%)" = ~ qwraps2::n_perc(pos == "pos."))
)

new_table <- summary_table(df, summaries = summary, by = "group",
                           qable_args = list()
)

new_table

image

I suspect this is problem with regex.

Issue found on this stackoverflow post

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions