Skip to content

Commit 37c351d

Browse files
chlebowagithub-actions[bot]averissimodependabot-preview[bot]pawelru
authored
clean up after pre-release-cleanup (#537)
Proof reading documentation and code comments. --------- Signed-off-by: Aleksander Chlebowski <114988527+chlebowa@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com>
1 parent d108440 commit 37c351d

File tree

77 files changed

+1121
-1334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1121
-1334
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Authors@R: c(
1919
person("Junlue", "Zhao", role = "aut"),
2020
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd"))
2121
)
22-
Description: Module containing filter panel for 'teal' applications.
22+
Description: Data filtering module for 'teal' applications.
2323
Allows for interactive filtering of data stored in 'data.frame' and
2424
'MultiAssayExperiment' objects. Also displays filtered and unfiltered
2525
observation counts.

NAMESPACE

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,13 @@ S3method(init_filtered_dataset,data.frame)
2626
S3method(init_filtered_dataset,default)
2727
S3method(print,teal_slice)
2828
S3method(print,teal_slices)
29-
S3method(variable_types,DFrame)
30-
S3method(variable_types,DataTable)
31-
S3method(variable_types,data.frame)
32-
S3method(variable_types,default)
33-
S3method(variable_types,matrix)
3429
export(FilterPanelAPI)
3530
export(as.teal_slice)
3631
export(as.teal_slices)
3732
export(clear_filter_states)
3833
export(get_filter_expr)
3934
export(get_filter_state)
35+
export(get_supported_filter_varnames)
4036
export(init_filter_states)
4137
export(init_filtered_data)
4238
export(init_filtered_dataset)

R/FilterPanelAPI.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' filter panel API.
1818
#'
1919
#' @examples
20-
#' fd <- init_filtered_data(list(iris = list(dataset = iris)))
20+
#' fd <- init_filtered_data(list(iris = iris))
2121
#' fpa <- FilterPanelAPI$new(fd)
2222
#'
2323
#' # get the actual filter state --> empty named list
@@ -71,7 +71,7 @@ FilterPanelAPI <- R6::R6Class( # nolint
7171
#' Sets active filter states.
7272
#' @param filter (`teal_slices`)
7373
#'
74-
#' @return `NULL` invisibly
74+
#' @return `NULL`, invisibly.
7575
#'
7676
set_filter_state = function(filter) {
7777
private$filtered_data$set_filter_state(filter)
@@ -85,7 +85,7 @@ FilterPanelAPI <- R6::R6Class( # nolint
8585
#' specifying `FilterState` objects to remove;
8686
#' `teal_slice`s may contain only `dataname` and `varname`, other elements are ignored
8787
#'
88-
#' @return `NULL` invisibly
88+
#' @return `NULL`, invisibly.
8989
#'
9090
remove_filter_state = function(filter) {
9191
private$filtered_data$remove_filter_state(filter)
@@ -99,7 +99,7 @@ FilterPanelAPI <- R6::R6Class( # nolint
9999
#' `datanames` to remove their `FilterStates`;
100100
#' omit to remove all `FilterStates` in the `FilteredData` object
101101
#'
102-
#' @return `NULL` invisibly
102+
#' @return `NULL`, invisibly.
103103
#'
104104
clear_filter_states = function(datanames) {
105105
datanames_to_remove <- if (missing(datanames)) private$filtered_data$datanames() else datanames

R/FilterState-utils.R

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
#' Initializes `FilterState`
1+
#' Initialize `FilterState`
22
#'
3-
#' Initializes `FilterState` depending on a variable class.
3+
#' Initializes a `FilterState` object corresponding to the class of the filtered variable.
44
#'
55
#' @param x (`vector`)
6-
#' values of the variable used in filter
6+
#' variable to be filtered.
77
#' @param x_reactive (`reactive`)
88
#' returning vector of the same type as `x`. Is used to update
99
#' counts following the change in values of the filtered dataset.
1010
#' If it is set to `reactive(NULL)` then counts based on filtered
1111
#' dataset are not shown.
1212
#' @param slice (`teal_slice`)
13-
#' object created using [teal_slice()].
13+
#' specification of this filter state.
14+
#' `teal_slice` is stored in the object and `set_state` directly manipulates values within `teal_slice`.
15+
#' `get_state` returns `teal_slice` object which can be reused in other places.
16+
#' Note that `teal_slice` is a `reactiveValues`, which means it has reference semantics, i.e.
17+
#' changes made to an object are automatically reflected in all places that refer to the same `teal_slice`.
1418
#' @param extract_type (`character`)
1519
#' specifying whether condition calls should be prefixed by `dataname`. Possible values:
1620
#' - `character(0)` (default) `varname` in the condition call will not be prefixed
1721
#' - `"list"` `varname` in the condition call will be returned as `<dataname>$<varname>`
1822
#' - `"matrix"` `varname` in the condition call will be returned as `<dataname>[, <varname>]`
19-
#' @param ... additional arguments to be saved as a list in `private$extras` field
2023
#'
2124
#' @examples
2225
#' # use non-exported function from teal.slice
23-
#' include_js_files <- getFromNamespace("include_js_files", "teal.slice")
2426
#' init_filter_state <- getFromNamespace("init_filter_state", "teal.slice")
2527
#'
2628
#' filter_state <- init_filter_state(
2729
#' x = c(1:10, NA, Inf),
2830
#' x_reactive = reactive(c(1:10, NA, Inf)),
2931
#' slice = teal_slice(
30-
#' varname = "x",
32+
#' varname = "varname",
3133
#' dataname = "dataname"
3234
#' ),
3335
#' extract_type = "matrix"
@@ -218,11 +220,7 @@ init_filter_state.POSIXlt <- function(x,
218220
#' Initialize a `FilterStateExpr` object
219221
#'
220222
#' @param slice (`teal_slice_expr`)
221-
#' object created using [teal_slice()]. `teal_slice` is stored
222-
#' in the class and `set_state` directly manipulates values within `teal_slice`. `get_state`
223-
#' returns `teal_slice` object which can be reused in other places. Beware, that `teal_slice`
224-
#' is a `reactiveValues` which means that changes in particular object are automatically
225-
#' reflected in all places which refer to the same `teal_slice`.
223+
#' specifying this filter state.
226224
#'
227225
#' @return `FilterStateExpr` object
228226
#' @keywords internal
@@ -241,6 +239,13 @@ init_filter_state_expr <- function(slice) {
241239
#' set to NULL to omit adding the alpha channel
242240
#'
243241
#' @return Named `character(1)` containing a hexadecimal color representation.
242+
#'
243+
#' @examples
244+
#' fetch_bs_color <- getFromNamespace("fetch_bs_color", "teal.slice")
245+
#' fetch_bs_color("primary")
246+
#' fetch_bs_color("danger", 0.35)
247+
#' fetch_bs_color("danger", "80")
248+
#'
244249
#' @keywords internal
245250
#'
246251
fetch_bs_color <- function(color, alpha = NULL) {
@@ -251,7 +256,6 @@ fetch_bs_color <- function(color, alpha = NULL) {
251256
)
252257

253258
# locate file that describes the current theme
254-
## TODO this is not ideal
255259
sass_file <- if (utils::packageVersion("bslib") < as.package_version("0.5.1.9000")) {
256260
bslib::bs_theme()[["layers"]][[2]][["defaults"]][[1]]
257261
} else {

0 commit comments

Comments
 (0)