Create Curve Table from two data frame or tibble inputs
curve_batch_annot
and curve_data_wide
. Both input must have at least one
common column. The default common column names is Sample_Name
.
Usage
create_curve_table(
curve_batch_annot,
curve_data_wide,
common_column = c("Sample_Name"),
signal_var = "Signal",
column_group = "Curve_Name"
)
Arguments
- curve_batch_annot
A data frame or tibble that contains information of your curve batch. A column with sample name should be present.
- curve_data_wide
A wide format data frame or tibble that contains the Sample Name usually at the first column followed by different curves. Each curve is meant to provide a
signal_var
for each sample.- common_column
A vector consisting of common column names that must be found in both
curve_batch_annot
andcurve_data_wide
, Default: c("Sample_Name")- signal_var
Value provided in
curve_data_wide
for each curve which will be used as a column name when the merged data is converted to a long format, Default: 'Signal'- column_group
Value used to group the curves in
curve_data_wide
when the merged data is converted to a long format, Default: 'Curve_Name'
Details
We first merge the curve_batch_annot
with the curve_data_wide
via one or more common columns. Next we convert the data from a wide to
a long format. Merging with a Sample Annotation data can be done after this
Examples
# Data Creation
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"
)
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_batch_annot <- tibble::tibble(
Sample_Name = sample_name,
Curve_Batch_Name = curve_batch_name,
Concentration = concentration
)
curve_data_wide <- tibble::tibble(
Sample_Name = sample_name,
`Curve_1` = curve_1_good_linearity,
`Curve_2` = curve_2_good_linearity
)
# Create curve table
curve_table <- create_curve_table(
curve_batch_annot = curve_batch_annot,
curve_data_wide = curve_data_wide,
common_column = "Sample_Name",
signal_var = "Signal",
column_group = "Curve_Name"
)
print(curve_table, width = 100)
#> # A tibble: 24 × 5
#> Sample_Name Curve_Batch_Name Concentration Curve_Name Signal
#> <chr> <chr> <dbl> <chr> <dbl>
#> 1 Sample_010a B1 10 Curve_1 22561
#> 2 Sample_010a B1 10 Curve_2 2299075
#> 3 Sample_020a B1 20 Curve_1 31178
#> 4 Sample_020a B1 20 Curve_2 4136350
#> 5 Sample_040a B1 40 Curve_1 39981
#> 6 Sample_040a B1 40 Curve_2 7020062
#> 7 Sample_060a B1 60 Curve_1 48390
#> 8 Sample_060a B1 60 Curve_2 8922063
#> 9 Sample_080a B1 80 Curve_1 52171
#> 10 Sample_080a B1 80 Curve_2 9288742
#> # … with 14 more rows