Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 65 forks source link

Export keys.as.row.names to panderOptions #355

Open connorp opened 2 years ago

connorp commented 2 years ago

I call pander implicitly in my Rmarkdown documents by setting df_print: !expr pander::pander in my YAML header. This mostly works well, as I just set options to modify pander's behavior using panderOptions. However, not every option is available. In particular, keys.as.row.names is not available to set via panderOptions. Could that be added as a globally settable option?

daroczig commented 2 years ago

I'd be open to a PR on this, but my concern is that there are many other options in the S3 methods that are not available via panderOptions, so it would be quite a lot of work to support all, and/or decide which params to extract to panderOptions.

That approach could also use a refactor .. it was written almost 10 yrs ago :sweat_smile:
Today I would probably do that in another way.

Anyway, to be more constructive, what about a wrapper helper function for your exact use case and call that in df_print?

pander2 <- function(x, ...) pander::pander(x, keys.as.row.names = FALSE, ...)