Can you list all the global options that can be set for a package?

From the vignette tibble I read that some changes can be made to the global options via options

to control the appearance of the print. However, I haven't been able to find any guidance on these options in R. I don't even know what fields can be added to the global options for a package. So the question is:

Can get a list of fields for the packet (e.g. tibble.print_max

, tibble.print_min

to tibble

and BioC_mirror

for utils

) that can be set by options

using the R, before knowing their

+3


source to share


2 answers


Given the lack of necessary practice (like CRAN) for handling parameters in external (or even internal, as far as I can tell) packages, perhaps the most general approach is as follows:

Step 3 can be automated better if you clone the repo to your computer and use command line tools for example.



cd package_dir
grep option R/*

      

(this is very similar to the above, but provides complete flexibility grep

)

Just for further confirmation, this approach got me to the right place for data.table

and xtable

.

+4


source


How custom parameters are handled depends on the author of the package (whether they include them .Options

, hide them, etc.). It looks like there is a hidden variable in the tibble package op.tibble

that shows the available options.

tibble:::op.tibble
# $tibble.print_max
# [1] 20
# 
# $tibble.print_min
# [1] 10
#
# $tibble.width
# NULL
#
# $tibble.max_extra_cols
# [1] 100

      

So, below are the names of the available options in the package.

names(tibble:::op.tibble)
# [1] "tibble.print_max"      "tibble.print_min"     
# [3] "tibble.width"          "tibble.max_extra_cols"

      



As a side note, I found op.tibble

it by doing

grep("op", ls(getNamespace("tibble"), all=TRUE), value=TRUE)
# [1] "op.tibble"  "stopc"      "tibble_opt"

      

and then view these items individually. Perhaps other authors can do something similar. But there is no general rule for defining options in packages.

+5


source







All Articles