@@ -274,6 +274,7 @@ peak_detection_windows_dynamic <- function(
274274 sort(unique(as.character(.data $ condition_id ))),
275275 collapse = " , "
276276 ),
277+ n = n(),
277278 .groups = " drop"
278279 ) | >
279280 # Build a readable axis label from the exact SCR scoring-window definition
@@ -300,7 +301,8 @@ peak_detection_windows_dynamic <- function(
300301 cols = - all_of(c(
301302 " scr_scoring_approach" ,
302303 " condition_ids_per_scoring" ,
303- " scoring_window_definition"
304+ " scoring_window_definition" ,
305+ " n"
304306 )),
305307 names_to = c(" measure" , " window" , " timepoint" ),
306308 names_pattern = " (scr)_(.*)_window_(.*)"
@@ -345,7 +347,14 @@ peak_detection_windows_dynamic <- function(
345347 factor (levels = c(" Baseline" , " Peak Detection" , " Trough Detection" ))
346348 ) | >
347349 # Only complete numeric intervals can be drawn as geom_segment() rows.
348- tidyr :: drop_na(all_of(c(" start" , " end" )))
350+ tidyr :: drop_na(all_of(c(" start" , " end" ))) | >
351+ mutate(
352+ condition_ids_per_scoring = if_else(
353+ n == 1 ,
354+ paste(" Dataset ID:" , condition_ids_per_scoring ),
355+ paste(" Dataset IDs:" , condition_ids_per_scoring )
356+ )
357+ )
349358
350359 # Supported columns can still produce no plottable rows if all endpoint values
351360 # were missing or non-numeric, so give a data-quality error before ggplot.
@@ -475,7 +484,7 @@ peak_detection_windows_dynamic <- function(
475484 yend = .data $ end ,
476485 color = .data $ window ,
477486 group = .data $ window ,
478- tooltip = paste( " Dataset ID(s): " , .data $ condition_ids_per_scoring ) ,
487+ tooltip = .data $ condition_ids_per_scoring ,
479488 data_id = .data $ plot_group
480489 ),
481490 linewidth = segment_linewidth
0 commit comments