Skip to contents

This function extracts information on run data, O2K machine number and sample IDs from a user-defined column and converts the tibble into a cleaner structure. This can either be in a 'wide' (one column per state, one row per sample) or 'longer' (each row is one state in one sample) format.

Usage

oxy_tbl_format(
  data,
  info_col = "filename",
  sample_identifiers = "NULL",
  wider = FALSE
)

Arguments

data

A tibble with at least four columns: one with information to extract, one with the respiratory state, and one for each chamber.

info_col

A character string of the name of the column containing the information to extract. Defaults to filename.

sample_identifiers

A vector of character strings that can be used to identify a sample. For example: if the samples are "abc - ctrl" (Chamber A) and "xyz - ctrl" (Chamber B), then sample_identifiers = c("abc - ctrl", "xyz - ctrl"). Each identifier must uniquely match a specific sample and the specified information column must contain identifiers for both samples: if this is not correct the sole sample ID name will be duplicated for both Chambers.

wider

Whether to return a wide (one column per state, one row per sample) or longer (each row is one state in one sample) tibble. Must be TRUE or FALSE.

Value

A tibble containing formatted oxygen flux values.

Examples

 example_data <-  oxy_tbl_format(
   data = output_from_o2k_oxy_list_to_tbl,
   info_col = "filename",
   sample_identifiers = c("NDi1-OE x gal4", "NDi1-OE ctrl"),
   wider = FALSE
  )
#> Error: object 'output_from_o2k_oxy_list_to_tbl' not found