Waterfall component of WFPHM
wfphm_wf.Rd
Waterfall component of WFPHM
Usage
wfphm_wf_UI(id)
wfphm_wf_server(
id,
bm_dataset,
group_dataset,
cat_var,
par_var,
visit_var,
subjid_var,
value_vars,
.default_group_palette = function(x) {
pal_get_cat_palette(x,
viridisLite::viridis(length(unique(x))))
},
bar_group_palette = list(),
margin
)
Arguments
- id
Shiny ID
[character(1)]
- cat_var, par_var, visit_var, subjid_var
[character(1)]
columns used as indicated in the details section
- value_vars
[character(1+)]
possible colum values. If column is labelled, label will be displayed in the value menu
- bar_group_palette
[list(palettes)]
list of custom palettes to apply to bar_grouping. It receives the values used for grouping and must return a DaVinci palette. Each palette is applied when the name of the entry in the list matches the name of the column used for grouping
- margin
[numeric(4) | shiny::reactive(numeric(4)) | shinymeta::metaReactive(numeric(4))]
margin to be used on each of the sides. It must contain four entries named
top
,bottom
,left
andright
- dataset
[shiny::reactive(data.frame) | shinymeta::metaReactive(data.frame)]
It expects the following format:
it contains, at least, the columns specified in the parameters:
cat_var
,par_var
,value_vars
,visit_var
andsubjid_var
cat_var
,par_var
,visit_var
andsubjid_var
columns are factors
Details
Data subsetting:
Allows selecting a column from all factor or character columns, from now on grouping_selection.
Menu labelled: Grouping
Data selection for plotting can be done in two modes switched by:
Menu labelled: Display demographic baseline information
Mode 1:
Allows selecting a column from the set of all numerical columns, from now on value_selection.
Menu labelled: Value
Subsets the dataset to the columns grouping_selection,
subj_var
and value_selection.Removes all repeated rows from the dataset
If more than one row have the same
subj_var
an informative error indicating the plot cannot be created is shown.
Mode 2:
Allows selecting a value from the
cat_var
column, from now on cat_selection and a value from thepar_var
column from the subset of rows wherepar_cat
is equal to cat_selection from now on par_selection.Menu labelled: Category and Parameter
Allows selecting between the columns defined in
val_var
from now on value_selection.Menu labelled: Value
Allows selecting a value from
visit_var
column, from now on visit_selection.Menu labelled: Visit
Subsets the dataset rows where:
visit_var
equal to visit_selectionpar_var
equal to par_selection
Subsets the dataset to the grouping_selection, the
subj_var
and the value_selection.If more than one row have the same
subj_var
an informative error indicating the plot cannot be created is shown.
Then the dataset is prepared to be passed to bar_D3:
subj_var
becomesx
columnval_selection
becomesy
columnthe label attribute of
y
column is eithervalue_selection
in Mode 1 orpar_selection
in Mode 2grouping_selection
becomesz
columngrouping_selection
becomeslabel
column
Completing the dataset:
Subset dataset will be completed in the following way. If any level in
x
is not present in the subset dataset, but it was present in thesubj_var
column in the original dataset, a row is added wherex
is equal to the missing valuey
is NA andz
is NA.
Data outliers:
Allows setting two limits upper and lower, values above or below in the subsetted dataset will be considered outliers. Rows considered outliers will have the column:
label
replaced by "outlier"color
equal to "gray"
Rows not considered outliers will have the column:
color
equal to NA
X axis sorting
x
levels are sorted from greater to lower value iny
Then a call to bar_D3 is done with the following arguments:
data
=subset dataset
(as described above)x_axis
=NULL
y_axis
=W
z_axis
= NULLmargin
is the parameter passed to this same functionpalette
is hardcoded with 8 colors. After 8 categories colors are repeatedmsg_func
= NULLquiet
= TRUE