2 ms·
CSV is also great for importing external data into documents. My text editor, KeenWrite[0], includes an R engine and a CSV-to-Markdown function[1]. This means y
by thangalin 4y ago
CSV is also great for importing external data into documents. My text editor, KeenWrite[0], includes an R engine and a CSV-to-Markdown function[1]. This means you can write the following in a plain text R Markdown document:
`r#csv2md('filanme.csv')`
The editor will convert Markdown to XHTML in the preview panel (in real time), then ConTeXt can typeset the XHTML into a PDF file in various styles.[2][3] This avoids spending time fighting with table formatting/consistency in certain word processors while storing the data in a machine-friendly format. (Thereby upholding the DRY principle because the data can have a single source of truth, as opposed to copying data into documents, which could go stale/diverge.)
Using JSON would be possible, but it's not as easy to convert into a Markdown table.
[0]: https://github.com/DaveJarvis/keenwrite https://github.com/DaveJarvis/keenwrite
[1]: https://github.com/DaveJarvis/keenwrite/blob/main/R/csv.R#L35 https://github.com/DaveJarvis/keenwrite/blob/main/R/csv.R#L3...
[2]: https://i.ibb.co/6FLXKsD/keenwrite-csv.png https://i.ibb.co/6FLXKsD/keenwrite-csv.png
[3]: https://i.ibb.co/47h6zNx/keenwrite-table.png https://i.ibb.co/47h6zNx/keenwrite-table.png