date_to_sample_order {proBatch}R Documentation

Convert date/time to POSIXct and rank samples by it

Description

Converts date/time columns fo sample_annotation to POSIXct format and calculates sample run rank in order column

Usage

date_to_sample_order(
  sample_annotation,
  time_column = c("RunDate", "RunTime"),
  new_time_column = "DateTime",
  dateTimeFormat = c("%b_%d", "%H:%M:%S"),
  new_order_col = "order",
  instrument_col = "instrument"
)

Arguments

sample_annotation

data frame with:

  1. sample_id_col (this can be repeated as row names)

  2. biological covariates

  3. technical covariates (batches etc)

. See help("example_sample_annotation")

time_column

name of the column(s) where run date & time are specified. These will be used to determine the run order

new_time_column

name of the new column to which date&time will be converted to

dateTimeFormat

POSIX format of the date and time. See as.POSIXct from base R for details

new_order_col

name of column with generated the order of sample run based on time columns

instrument_col

column, denoting different instrument used for measurements

Value

sample annotation file with a new column new_time_column with POSIX-formatted date & new_order_col used in some diagnostic plots (e.g. plot_iRT, plot_sample_mean)

Examples

sample_annotation_wOrder <- date_to_sample_order(
example_sample_annotation,
time_column = c('RunDate','RunTime'),
new_time_column = 'new_DateTime',
dateTimeFormat = c("%b_%d", "%H:%M:%S"),
new_order_col = 'new_order',
instrument_col = NULL)


[Package proBatch version 1.10.0 Index]