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
source to share
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:
-
Find the package on the CRAN mirror on GitHub . For example, here
tibble
. -
Search for "option" in the repository to find all references to "option" in the package code .
-
Search on this issue. It takes a bit of a look around to know what to look for, but I found out that all the options
tibble
are listed in the main package's help page (?"tibble-package"
) because I found those search lines .
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
.
source to share
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.
source to share