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

Multiple panderOptions #333

Open ymer opened 5 years ago

ymer commented 5 years ago

Is there a way to set multiple pander options in the same command? I feel it clutters the code to have 3+ lines of panderOptions commands.

dcomtois commented 5 years ago

In summarytools, made the transition from the method used in pander to the one you suggest. If anyone wants to work on it, I think this would be a good basis. Note that it supports the "legacy" way of settings options, too.

https://github.com/dcomtois/summarytools/blob/dev-current/R/st_options.R

daroczig commented 5 years ago

Sorry for the late reply, did not really have time to work on pander recently -- but planning to spend more time on this in 2019 and probably release v1.0 with quite some refactoring and cleaning up these legacy issues (with potentially with some minor breaking changes as well). Until then, you could try something like

multiPanderOptions <- function(...) {
    options <- list(...)
    for (i in seq_along(options)) {
        panderOptions(names(options)[i], options[[i]])
    }
}
multiPanderOptions(digits = 5, decimal.mark = ',', 5)