Parameter heatmap component of WFPHM
wfphm_hmpar.Rd
Parameter heatmap component of WFPHM
Usage
wfphm_hmpar_UI(id, tr_choices)
wfphm_hmpar_server(
id,
dataset,
cat_var,
par_var,
visit_var,
subjid_var,
value_vars,
sorted_x,
tr_mapper,
margin,
show_x_ticks
)
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_var
andsubjid_var
cat_var
,par_var
,visit_var
andsubjid_var
columns are factorsvalue_vars
must be numeric
- cat_var, par_var, visit_var, subjid_var
[character(1)]
- value_vars
[character(1+)]
possible colum values. If column is labelled, label will be displayed in the value menu
- tr_mapper
[function(1+)]
named list containing a set of unary functions to transform the data. The name is the string shown in a selector and the value is the function to be applied according to details section.
- 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
- show_x_ticks
[logical(1)]
show x ticks in the parameter heatmap
Details
Data subsetting:
Allows selecting several values from the
cat_var
column, from now on cat_selection and several values 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
value_vars
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
par_var
,subj_var
and the value_selection.If more than one row have the same combination
subj_var
andpar_var
an informative error indicating the plot cannot be created is shown.
Then the dataset is prepared to be passed to heatmap_D3:
subj_var
becomesx
columnthe label attribute of
x
column isSubject ID
par_var
becomesy
columnvalue_selection
becomesz
columnz
becomeslabel
column
Completing the dataset:
Subset dataset will be completed in the following way. All non-present combination of the original levels of
x
and 'y' is are added with rows where:x
andy
are equal to the missing combinationz
is NA
Data outliers:
Allows setting two limits upper and lower for
y
value, values above or below in the subsetted dataset will be considered outliers. Rows considered outliers will have the column:label
replaced by "x"color
equal to "fill: white; font-weight: bold;"
Rows not considered outliers will have the column:
color
equal to NA
Data transformation:
Allows selecting between a set of functions as defined in
tr_mapper
from now on transformation_function.Menu labelled: Transformation
This transformation is applied to the subset dataset grouped by the
y
column. i.e. each row of the heatmap is transformed independently.The function must be unary, and the unique argument will be the numerical values of a given row of the hetamap.
X axis ordering
x
levels are ordered according tosorted_x
Then a call to heatmap_D3 is done with the following arguments:
data
=subset dataset
(as described above)x_axis
=S
y_axis
=W
z_axis
=E
margin
is the parameter passed to this same functionpalette
is hardcoded toRColorBrewer::brewer.pal(n = 8, name = "Set2")
after 8 categories colors are repeatedmsg_func
= NULLquiet
= TRUE