Validate trellis table to see if it can be used to create
trelliscopejs
report
Usage
validate_trellis_table(
trellis_table,
grouping_variable = c("Curve_Name", "Curve_Batch_Name"),
panel_variable = "panel"
)
Arguments
- trellis_table
The trellis table generated by function
add_plotly_panel()
- grouping_variable
A character vector of column names in
trellis_table
to indicate how each curve should be grouped by. It is also going to be used as a conditional cognostics in thetrelliscopejs
report. The function will check if these columns are indeed conditional cognostics Default: c("Curve_Name", "Curve_Batch_Name")- panel_variable
A column name in
trellis_table
to indicate the list of plots to be used in thetrelliscopejs
report. This column name must be fixed to the namepanel
and it must be of classtrelliscope_panels
Default: 'panel'
Details
A valid trellis table must have a column named panel
with
a list of plots and class trelliscope_panels
, conditional cognostics
columns as indicated in grouping_variable
and the rest of the columns
as common cognostics
Examples
sample_name <- c(
"Sample_010a", "Sample_020a", "Sample_040a",
"Sample_060a", "Sample_080a", "Sample_100a",
"Sample_010b", "Sample_020b", "Sample_040b",
"Sample_060b", "Sample_080b", "Sample_100b"
)
curve_1_good_linearity <- c(
22561, 31178, 39981, 48390, 52171, 53410,
32561, 41178, 49981, 58390, 62171, 63410
)
curve_2_good_linearity <- c(
2299075, 4136350, 7020062, 8922063, 9288742, 11365710,
2300075, 4137350, 7021062, 8923063, 9289742, 11366710
)
curve_data <- tibble::tibble(
Sample_Name = sample_name,
`Curve_1` = curve_1_good_linearity,
`Curve_2` = curve_2_good_linearity
)
concentration <- c(
10, 20, 40, 60, 80, 100,
10, 20, 40, 60, 80, 100
)
curve_batch_name <- c(
"B1", "B1", "B1", "B1", "B1", "B1",
"B2", "B2", "B2", "B2", "B2", "B2"
)
curve_batch_annot <- tibble::tibble(
Sample_Name = sample_name,
Curve_Batch_Name = curve_batch_name,
Concentration = concentration
)
# Create curve table
curve_table <- create_curve_table(
curve_batch_annot = curve_batch_annot,
curve_data_wide = curve_data,
common_column = "Sample_Name",
signal_var = "Signal",
column_group = "Curve_Name"
)
# Create a trellis table without curve summary
trellis_table <- add_plotly_panel(
curve_table,
grouping_variable = c("Curve_Name",
"Curve_Batch_Name"),
sample_name_var = "Sample_Name",
curve_batch_var = "Curve_Batch_Name",
conc_var = "Concentration",
conc_var_units = "%",
conc_var_interval = 50,
signal_var = "Signal"
) |>
convert_to_cog(
cog_df = NULL,
grouping_variable = c(
"Curve_Name",
"Curve_Batch_Name"
),
panel_variable = "panel",
col_name_vec = "col_name_vec",
desc_vec = "desc_vec",
type_vec = "type_vec"
)
# Check if trellis_table is valid
validate_trellis_table(
trellis_table,
grouping_variable = c("Curve_Name",
"Curve_Batch_Name"),
panel_variable = "panel"
)