Add Blank Rows To Data Frame For Missing Sweeps/Trials
Source:R/data_processing.R
      insert_rows_for_missing_sweeps.RdEvents may not occur on every sweep/trial, this will add a blank row for sweeps without events. Thus, creating continuous sweep data allowing for addition of condition tags and/or analysis by sweep number.
Arguments
- df
 Data Frame or Tibble, with the following columns:
sweep
- sweep_count
 Numeric, total number of sweeps.
Value
Appended data.frame with rows for sweeps/trials without events, only the ordered factor column, sweep,
will contain a integer values, all other row values are NA.
Examples
simple_df <- data.frame(
  rec_time_ms = c(400, 4400),
  sweep = ordered(c(1, 5), levels = c(1:5))
)
insert_rows_for_missing_sweeps(
  df = simple_df,
  sweep_count = 5
)
#>   rec_time_ms sweep
#> 1         400     1
#> 2          NA     2
#> 3          NA     3
#> 4          NA     4
#> 5        4400     5