Skip to contents

This function takes the output from `timer_transform`, specifically the `sample_definition` data frame, exports it to a CSV file for the user to edit group assignments, and then reads the updated file back into R.

Usage

sample_definition(
  x,
  sample_definition = NULL,
  output_dir = NULL,
  filename = "sampledef.csv",
  sep = ",",
  verbose = TRUE,
  interactive = FALSE
)

Arguments

x

A TockyPrepData object returned by `timer_transform`.

sample_definition

(Optional) to use a data frame object as an annotation data for sample grouping. Defaul is `NULL`.

output_dir

Character string specifying the directory to save the `sampledef.csv` file. If `NULL`, the file is saved in the current working directory. Default is `NULL`.

filename

Character string specifying the name of the sample definition file. Default is `"sampledef.csv"`.

sep

Character string indicating the field separator used in the CSV file. Default is `","`.

verbose

Logical indicating whether to display messages. Default is `TRUE`.

interactive

Logical indicating whether to use an interactive session to export a file for sample grouping and enable user to edit it and import. Defaults to `TRUE`.

Value

An updated TockyPrepData with user-assigned groupings.

Examples

if (FALSE) { # \dontrun{
  # Assuming `x` is the output from `timer_transform`
  x <- sampledef(x, output_dir = "output_directory")
  # The function will pause, allowing you to edit the 'group' column in the CSV file.
  # After editing and saving the file, press Enter in R to continue.
  # The updated sample definitions will be returned as a data frame.
} # }