This will calculate a normalized amplitude based upon a user defined baseline - set using the args:
normalize_condition
and normalize_stimulus
. The baseline is calculated from the mean amplitude of
first "event" after the user-defined normalize_stimulus
value.
Arguments
- df
Data Frame or Tibble, with the following columns:
sweep
amplitude
condition
stimulus
event_index
- normalize_condition
Character, the condition to normalize all amplitudes against, defaults to 'control'.
- normalize_stimulus
Numeric, the stimulus to normalize against, defaults to '1'.
Examples
simple_df <-
data.frame(
sweep = c(1:20),
amplitude = rep(c(100, 50), each = 10),
condition = rep(c("control", "drug_1"), c(10, 10)),
stimulus = 1,
event_index = 1
)
add_normalized_amplitude(simple_df,
normalize_condition = "control",
normalize_stimulus = 1
)
#> sweep amplitude condition stimulus event_index amplitude_normalized
#> 1 1 100 control 1 1 1.0
#> 2 2 100 control 1 1 1.0
#> 3 3 100 control 1 1 1.0
#> 4 4 100 control 1 1 1.0
#> 5 5 100 control 1 1 1.0
#> 6 6 100 control 1 1 1.0
#> 7 7 100 control 1 1 1.0
#> 8 8 100 control 1 1 1.0
#> 9 9 100 control 1 1 1.0
#> 10 10 100 control 1 1 1.0
#> 11 11 50 drug_1 1 1 0.5
#> 12 12 50 drug_1 1 1 0.5
#> 13 13 50 drug_1 1 1 0.5
#> 14 14 50 drug_1 1 1 0.5
#> 15 15 50 drug_1 1 1 0.5
#> 16 16 50 drug_1 1 1 0.5
#> 17 17 50 drug_1 1 1 0.5
#> 18 18 50 drug_1 1 1 0.5
#> 19 19 50 drug_1 1 1 0.5
#> 20 20 50 drug_1 1 1 0.5