Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pander and xtable for matrix, data.frame and so on #35

Open
jankatins opened this issue Mar 15, 2016 · 3 comments
Open

Use pander and xtable for matrix, data.frame and so on #35

jankatins opened this issue Mar 15, 2016 · 3 comments

Comments

@jankatins
Copy link
Contributor

@daroczig raised the very valid point in Rapporter/pander#251, that we should not (re)implement how we do html and MD conversation of standard objects in repr:

Sorry for the silly question, but before figuring out the optimal next steps in short & long terms, why are you writing and maintaining the code for transforming R objects into HTML, tex or markdown? There's xtable and a bunch of other packages out there doing this and eg pander for markdown. So instead of having https://github.com/IRkernel/repr/blob/master/R/repr_matrix_df.r, you could simply call xtable for HTML or tex, and eg pander in a markdown notebook. Eg the pander way of writing reproducible reports is that you never call pander in your Rmd, as pander will be automatically applied on all the R objects.

@flying-sheep
Copy link
Member

mainly because at the time, i just wrote a bunch of reprs for several kinds of objects and didn’t know that there were packages already doing that specifically for tabular data.

we could use them but then we’d have to use an option adapter (i.e. translate repr options to the specific packages’ equivalents)

@jankatins
Copy link
Contributor Author

IMO we could either

repr_markdown.data.frame <- function(x)
   paste(capture_output(pander.data.frame(x)), collapse="\n")

or do a

repr_markdown.data.frame <- pander.data.frame

when/if pander supports a return mode...

Same for xtable...

@jankatins
Copy link
Contributor Author

Re options: why not simple tell them the pander options? Would make things like #14 much easier...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants