I have a chunk of code that creates a table containing file links based on files that's in a specific directory.
This knits fine in RMD, but not in in the quarto version.
Working Posit Cloud project example
Code:
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE)
library(stringr); library(dplyr); library(readxl)
library(knitr); library(kableExtra); library(tidyr)
options(knitr.kable.NA = '')
hw <- data.frame(filenames = paste0('hw/', list.files("hw", pattern='template|*.pdf|*.html|*.docx')))
out.hw <- hw %>% mutate(name = gsub("hw/|_template", "", filenames),
type = str_extract(hw$filenames,".{3}$"),
type = ifelse(type=="tml", "html", type),
type = ifelse(type=="ocx", "docx", type),
nam = gsub(".html|.pdf|.Rmd|.docx", "", name),
link = sprintf("[%s](%s)",type, filenames))
x = out.hw %>% select(link, type, nam) %>%
reshape2::dcast(nam~type, value.var="link") %>%
kable(format="html") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive" ,"bordered"),
full_width=FALSE, position = "left")
gsub("<thead>.*</thead>", "", x)
Rmarkdown
Quarto: