Rapporter/rapport

New feature: add suport for config files

aL3xa opened this issue · 6 comments

Okay, the idea is to add an R file (as @daroczig suggested), in which various rapport settings will take place. File should probably be named like .rapport.R or something. This issue should summarise all user customisable settings. Feel free to add/request new ones. At first, we'll support all settings available in init.R file.

That's a great idea indeed, thanks @aL3xa!

Just adding my 2 cents: .rapport.R or .rapport.conf might live in user's home dir (both on Unix-like systems and on Windows) and we might add a new line at the end of init.R to check if that files exists. If so, then it's sourced, so default settings would be overwritten. We just need a function to easily alter that file which would hold some options(...) calls.

Bumping this issue: why not ask users simply to add some tweaks in their .Rprofile instead of custom hacks?

My recent request fits this ticket, so here goes the "specification": instead of config files, users can tweak their default settings in .Rprofile. That's the R way :)

But we need to tweak the current options setup, which messes with global options and we are definitely cluttering up that. Please change the options to work like in pander package: https://github.com/Rapporter/pander/blob/master/R/options.R

In short: let us have a rapport option which would hold the current options in a list. Pls add a helper function (e.g. rapportOptions) like I did in pander where users can query and update those easily. Do not forget to update all options and getOption calls in the sources and in the docs :)

And a "fallback compatibility" would be awesome for loyal users, so if they have e.g. an rp.file.path option, then the custom rapportOptions fn should return that instead of the default one.

I have a few suggestions about this one:

  • if we move all options to rapport list, we don't need rp. prefix, or do we?
  • IMO, getter/setter approach is way better, e.g. rapportOption('tpl.paths') should return template paths, but rapportOption('tpl.paths') <- c('/my/path1', '/my/path2') would be a bit more elegant

Whadda U think?

Yeah, we can drop rp prefix.
About setter method: as you wish :)

rp prefix is gone in #93, and users can specify options in their .Rprofile, so let's say it's fixed