Waterfall component of WFPHM
wfphm_wf.RdWaterfall component of WFPHM
Waterfall UI function
Usage
wfphm_wf(
id,
dataset,
cat_var,
par_var,
visit_var,
subjid_var,
value_vars,
bar_group_palette,
margin
)
wfphm_wf_UI(id)Arguments
- id
Shiny ID
[character(1)]- 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_varandsubjid_varcat_var,par_var,visit_varandsubjid_varcolumns are factors
- 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,leftandright
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_varand value_selection.Removes all repeated rows from the dataset
If more than one row have the same
subj_varan informative error indicating the plot cannot be created is shown.
Mode 2:
Allows selecting a value from the
cat_varcolumn, from now on cat_selection and a value from thepar_varcolumn from the subset of rows wherepar_catis equal to cat_selection from now on par_selection.Menu labelled: Category and Parameter
Allows selecting between the columns defined in
val_varfrom now on value_selection.Menu labelled: Value
Allows selecting a value from
visit_varcolumn, from now on visit_selection.Menu labelled: Visit
Subsets the dataset rows where:
visit_varequal to visit_selectionpar_varequal to par_selection
Subsets the dataset to the grouping_selection, the
subj_varand the value_selection.If more than one row have the same
subj_varan informative error indicating the plot cannot be created is shown.
Then the dataset is prepared to be passed to bar_D3:
subj_varbecomesxcolumnval_selectionbecomesycolumnthe label attribute of
ycolumn is eithervalue_selectionin Mode 1 orpar_selectionin Mode 2grouping_selectionbecomeszcolumngrouping_selectionbecomeslabelcolumn
Completing the dataset:
Subset dataset will be completed in the following way. If any level in
xis not present in the subset dataset, but it was present in thesubj_varcolumn in the original dataset, a row is added wherexis equal to the missing valueyis NA andzis 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:
labelreplaced by "outlier"colorequal to "gray"
Rows not considered outliers will have the column:
colorequal to NA
X axis sorting
xlevels 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=NULLy_axis=Wz_axis= NULLmarginis the parameter passed to this same functionpaletteis hardcoded with 8 colors. After 8 categories colors are repeatedmsg_func= NULLquiet= TRUE