Maybe a silly question but is there a way to render a data frame in a R Markdown document as a human-readable table in a .md file?
I'll like to display an example of a rendered table as a code chunk on a pkgdown site. I'm rendering a temporary .rmd file in a temporary directory and then read the generated .md file to show the user what output to expect.
pipe produces the same output as simple in this case. I hadn't tried rst and it almost produces something acceptable. The only issue is that the table doesn't align well:
=== === x y
=== === 1 a
2 b
=== ===
I also tried jira and org that I hadn't tried before. jira also produces something acceptable but has the same problem as rst.
Since I'm showing the raw .rmd together with the rendered output, I'd prefer not to do these kind of transformations because they might confuse the users. I could of course use two separate chunks, one to display for the user and the other to render but that would be overkill. If there's no ways to do it with a particular argument or function, I'll simply not add that example.
I'm not sure to follow. What do you mean by 'import' here? How would you do that with the example in the first post? The output need to remain in a code chunk.
You said here that your are reading the generated .md. That is why I am talking about import.
In your first post, the fact that a HTML table is produced means that somehow the content was parsed by Pandoc and converted to HTML. I am guessing this because knitr::kable("simple") should output markdown not HTML.
I see. My initial post wasn't precise enough and I realize my example wasn't good either. I'm actually rendering a temporary R markdown document in an R subprocess and then read and display the markdown output from it, all this within an R code chunk. The actual example uses a table of citation keys that need to be processed by pandoc, hence my problem. A real life examples can be found here and its output there.
So I'll inevitably end up with the problem of alignement mentioned above if I use a format that pandoc doesn't convert to HTML like rst.