You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes#1066
Changes:
1. Verified the current options we support.
- ✅ teal (`teal.load_nest_code`, `teal.show_js_log`, `teal.bs_theme`)
- ✅ teal.logger (`teal.log_level`)
- ✅ teal.widgets (`teal.basic_table_args`, `teal.ggplot2_args`,
`teal.plot_dpi`)
- ✅ teal.slice (`teal.threshold_slider_vs_checkboxgroup`)
- ❌ teal.modules.general (`ggplot2.discrete.colour`)
- ❌ teal.modules.clinical (`ggplot2.discrete.colour`,
`tmc_default_total_label`)
2. Removed the context of where the options were implemented, it seems
unnecessary.
3. Reordered the options in the way that important and most used are at
the top and are grouped when possible. And, moved the depreciated
options to the bottom.
title: "Modifying a teal Application With R Options"
3
-
author: "Paweł Rucki"
3
+
author: "NEST CoreDev"
4
4
output: rmarkdown::html_vignette
5
5
vignette: >
6
6
%\VignetteIndexEntry{Modifying a teal Application With R Options}
@@ -11,7 +11,7 @@ editor_options:
11
11
---
12
12
13
13
# Motivation
14
-
Some `R` packages use `options` to modify their runtime behavior. These usually specify default values for internal functions or determine responses to users actions. For example, `testthat` uses an option `testthat.progress.max_fails` to define a default number of failed expectations before the testing functions terminate execution. While some of these adjustable values can be exposed as function parameters, some are confined to an option. This vignette details the options available to users of`teal`, `teal.logger`, `teal.widgets`, `teal.modules.general`,`teal.modules.clinical`.
14
+
Some `R` packages use `options` to modify their runtime behavior. They usually specify sensible default values for internal function arguments or determine responses to users actions. For example, `testthat` uses an option `testthat.progress.max_fails` to define a default number of failed expectations before the testing functions terminate execution. While some of these adjustable values can be exposed as function parameters, some are confined to an option. This vignette details the options available in the package`teal` and it's supporting packages `teal.logger`, `teal.widgets`, and`teal.slice`.
15
15
16
16
# Setting an option
17
17
At any time during an interactive session, you can change an option using:
@@ -33,42 +33,23 @@ getOption("option_to_set")
33
33
Once set, the value of an option persists during a session, but it returns to the default value in a new session. Make sure to change the options after all the `teal`-related packages are loaded because some of them initialize the options themselves and will overwrite your custom values.
34
34
35
35
# Options used in a `teal` application
36
-
### `teal.log_layout` (`character`)
37
-
This defines the layout of a log message used in a `teal` application. `teal` uses this layout to format the emitted log messages. Read the documentation of `teal.logger::register_logger` for more information.
Note that this layout is formatted by the `glue` package.
42
-
43
-
### `teal.log_level` (`character`)
44
-
This is the logging level threshold used in a `teal` application. A `teal` application will not emit logs below this level. Read the documentation of `teal.logger::register_logger` for more information. Possible values: `"TRACE"`, `"INFO"`, `"WARNING"`, `"ERROR"`. See the documentation of `logger::TRACE` for all possible values of logging threshold and more information on what it does.
45
-
46
-
Default: `"INFO"`.
47
36
48
-
Note that there are two levels considered less severe than `"INFO"`: `"DEBUG"` and `"TRACE"`. In order to see the log messages for these two levels as well, change the log level from the default to `"TRACE"`, the least severe log level.
49
-
50
-
### `teal_logging`
51
-
Deprecated.
37
+
### `teal.bs_theme` (`bslib::bs_theme` object)
38
+
This option controls the bootstrap theme and version used in `teal` apps. Achieve better UX with the customized UI of an app.
39
+
Please see the [vignette on Bootstrap themes](bootstrap-themes-in-teal.html) to read more about the functionality.
52
40
53
-
### `teal_show_js_log`
54
-
Deprecated in favor of `teal.show_js_log` (see below).
41
+
Default: `NULL`
55
42
56
-
### `teal.show_js_log` (`logical`)
57
-
This indicates whether to print the `JavaScript` console logs to the `R` console. If set to `TRUE`, the logs will be printed; otherwise, they won't.
43
+
### `teal.load_nest_code` (`character`)
44
+
The value of this option is appended to the top of the code rendered when using the `Show R Code` modal button.
58
45
59
-
Default: `FALSE`.
46
+
Default: `"# Add any code to install/load your NEST environment here"`.
This is the threshold that determines if a variable is treated as a factor in the filter panel. If the number of unique values of a variable is less than this threshold the variable will be treated as a factor instead of its original class. As an example, imagine `teal.threshold_slider_vs_checkboxgroup` equals to 2. Then a numeric variable `c(1, 1, 1)`, which has only one unique value, is treated as a factor in the filter panel (and in the filter panel only!). The filter panel creates a checkbox widget to filter values from this variable, as it would for a factor variable, instead of the usual numeric range selector.
63
50
64
51
Default: 5.
65
52
66
-
### `teal.load_nest_code` (`character`)
67
-
The value of this option is appended to the top of the code rendered when using the `Show R Code` modal button. See the documentation of `teal::get_rcode` for more information.
68
-
69
-
Default: `"# Add any code to install/load your NEST environment here"`.
This specifies the list of arguments passed to every call to `rtables::basic_table` made in a `teal` application. This can be used to format `rtables` without making any changes to the application code. See the documentation of `teal.widgets::basic_table_args` for more information.
74
55
@@ -80,12 +61,34 @@ This option allows modifying labels and themes of all `ggplot2` plots in a `teal
80
61
Default: `teal.widgets::ggplot2_args()`.
81
62
82
63
### `teal.plot_dpi` (integer value 24 or larger)
83
-
This option controls the dots per inch of the graphs rendered and downloaded when using `plot_with_settings`.
64
+
This option controls the dots per inch of the graphs rendered and downloaded when using the module `plot_with_settings` from the `teal.widgets` package.
84
65
85
66
Default: 72
86
67
87
-
### `teal.bs_theme` (`bslib::bs_theme` object)
88
-
This option controls the bootstrap theme and version used in `teal` apps. Achieve better UX with the customized UI of an app.
89
-
Please visit the vignette on Bootstrap themes to read more about the functionality.
68
+
### `teal.log_layout` (`character`)
69
+
This defines the layout of a log message used in a `teal` application. `teal` uses this layout to format the emitted log messages. Read the documentation of `teal.logger::register_logger` for more information.
Note that this layout is formatted by the `glue` package.
74
+
75
+
### `teal.log_level` (`character`)
76
+
This is the logging level threshold used in a `teal` application. A `teal` application will not emit logs below this level. Read the documentation of `teal.logger::register_logger` for more information. Possible values: `"TRACE"`, `"INFO"`, `"WARNING"`, `"ERROR"`. See the documentation of `logger::TRACE` for all possible values of logging threshold and more information on what it does.
77
+
78
+
Default: `"INFO"`.
79
+
80
+
Note that there are two levels considered less severe than `"INFO"`: `"DEBUG"` and `"TRACE"`. In order to see the log messages for these two levels as well, change the log level from the default to `"TRACE"`, the least severe log level.
81
+
82
+
### `teal.show_js_log` (`logical`)
83
+
This indicates whether to print the `JavaScript` console logs to the `R` console. If set to `TRUE`, the logs will be printed; otherwise, they won't.
84
+
85
+
Default: `FALSE`.
86
+
87
+
88
+
# Deprecated options
89
+
90
+
### `teal_logging`
91
+
Deprecated in favor of using the `teal.logger` package for logging.
92
+
93
+
### `teal_show_js_log`
94
+
Deprecated in favor of `teal.show_js_log` (see above).
0 commit comments