Quantcast
Channel: Active questions tagged kable - Stack Overflow
Viewing all articles
Browse latest Browse all 105

Rendering a `read_csv()` with markdown hyperlinks and linebreaks into a multi-line/grid table in a quarto website

$
0
0

I have a long and complicated table containing dates and topics of my course schedule page within a quarto website.

I decided to move it into a spreadsheet for flexibly manipulating individual cells. I would like to read and render this spreadsheet in a format similar to quarto's table seen in the above link. Hence I'm trying to render the table as a pipe(or grid) table in an R chunk within a .qmd quarto website page. I tried these two things -

  • kable(format = "pipe") works but does not produce a multi-line table since "pipe" format does not support \n newline characters(?)
  • pander::pandoc.table(style = "grid") generates a grid_table but it doesn't eventually render as a html and I only see the bare markdown code after the quarto render .` command on the full website

Here's a small reprex -

``` roptions(knitr.kable.NA = "")# ~~ Load schedule from the spreadsheetsch <-   structure(list(    Lec = c(1, 5),     Date = c("09/Jan", "25/Jan"),     Topic = c("Introductions and installations", "R basics contd."),     Details = c("[slides](lecture01.Rmd) ([PDF](https://bios-538.github.io/))", "for() ; function() and vectorization\n[lec5_demo](scripts/class5_demo_loops-functions.R), [lec5_practice](scripts/class5_practice_loops-functions.R)"    )),     class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -2L))# Render table with "pipe" format: \n (after vectorization) messes it upknitr::kable(sch, format = 'pipe')```
LecDateTopicDetails
109/JanIntroductions and installationsslides (PDF)
525/JanR basics contd.for() ; function() and vectorization
lec5_demo, lec5_practice
# Render table with pandoc.table "grid"/"rmarkdown" format: Only markdown code shows up, not final .htmlpander::pandoc.table(sch, style = 'grid')#> #> #> +-----+--------+-------------------+#> | Lec |  Date  |       Topic       |#> +=====+========+===================+#> |  1  | 09/Jan | Introductions and |#> |     |        |   installations   |#> +-----+--------+-------------------+#> |  5  | 25/Jan |  R basics contd.  |#> +-----+--------+-------------------+#> #> Table: Table continues below#> #>  #> #> +------------------------------------------------------------+#> |                          Details                           |#> +============================================================+#> |                  [slides](lecture01.Rmd)                   |#> |            ([PDF](https://bios-538.github.io/))            |#> +------------------------------------------------------------+#> |                   for() ; function() and                   |#> |                       vectorization                        |#> |    [lec5_demo](scripts/class5_demo_loops-functions.R),     |#> | [lec5_practice](scripts/class5_practice_loops-functions.R) |#> +------------------------------------------------------------+

Created on 2024-01-28 with reprex v2.1.0


Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>