These helpers build the exact flat tibble that ir_plot_traces()
(ir_generate_traces_tibble()), ir_plot_dual_inlet()
(ir_generate_cycles_tibble()), and ir_plot_scans()
(ir_generate_scans_tibble()) plot, so it can be inspected or used
independently of producing a plot. The dataset is prepared exactly as for
the plotting functions (an ir_aggregated_data object has its traces /
cycles / scans dataset inner-joined with $metadata; a plain data frame
is used as is), filtered by species, and then split into intensity rows and
(optionally) ratio rows, each augmented with four columns:
trace- the identifier"<species>: <mass>"for intensity rows (e.g."CO2: 44") or"<species>: <ratio_name>"for ratio rows (e.g."CO2: 45/44"), always (re)generated and returned as a factor sorted by species and numerical (numerator) mass. This is what the plotting functions group their lines by. Rows whosespeciesisNAget the bare mass/ratio name instead ("44","45/44") rather than an"NA: "prefix.color- the colour identifier, a factor listing every trace that shares a species and (numerator) mass: both"CO2: 45"and"CO2: 45/44"get"CO2: 45, 45/44"(or"45, 45/44"for anNAspecies). Mapping the colour aesthetic to this column (the plotting functions' default) is what draws an intensity trace and its ratios in the same colour while keeping them separate lines. Its levels follow thetraceorder, so the legend runs by ascending species/mass.data_type-"intensity [UNITS]"(e.g."intensity [mV]") for the intensity rows, or"ratios"for ratio rows.value- the value to plot: the intensity for intensity rows, or the (optionally fold-clamped) ratio for ratio rows.
Usage
ir_generate_traces_tibble(
dataset,
species = NULL,
mass = everything(),
ratio = everything()
)
ir_generate_cycles_tibble(
dataset,
species = NULL,
mass = everything(),
ratio = everything()
)
ir_generate_scans_tibble(
dataset,
species = NULL,
mass = everything(),
ratio = everything()
)Arguments
- dataset
an
ir_aggregated_dataobject fromir_aggregate_isofiles()or a plain data frame with the required columns (see the matching plotting function)- species
optional vector to filter to specific species (e.g.
"CO2"orc("N2", "CO2")); defaultNULLkeeps all species.- mass
which masses to include as intensity traces, as a tidyselect expression evaluated as if the masses present in the data were column names. The default
everything()includes every mass andNULL(orc()) includes none; beyond that any tidyselect syntax works, e.g.c("44", "45")or44:48for specific masses,-"45"/!"45"to exclude one, and helpers such asstarts_with("4"),matches(),all_of(), orany_of(). Unlike plain tidyselect, numbers select by name rather than by position (44:48means the masses 44 to 48, not the 44th to 48th mass). Selecting a mass that is not in the data is an error that lists the available masses; useany_of()to ignore missing ones.- ratio
which ratios to include (computed with
ir_calculate_ratios()), as a tidyselect expression evaluated as if the ratio names present in the data were column names - the same syntax asmass, e.g.everything()(the default, all available ratios),NULLfor none,c("45/44", "46/44"),-"45/44", orstarts_with("45"). Selecting specific ratios when ratios have not been calculated is an error pointing toir_calculate_ratios(); with the defaulteverything()(orNULL) and no ratios present, none are simply added.
