Skip to contents

Essentially a wrapper for tidyr::pivot_longer that works on both a single widemeasures as well as a list of widemeasures

Usage

trans_wide_to_tidy(
  wides,
  data_cols = NA,
  id_cols = NA,
  names_to = "Well",
  values_to = "Measurements",
  values_to_numeric = TRUE,
  ...
)

Arguments

wides

A single widemeasures data.frame, or a list of widemeasures data.frame's

data_cols, id_cols

Specifies which columns have data vs are ID's (in pivot_longer parlance). Each can be a single vector (which will be applied for all widemeasures) or a list of vectors, with each vector corresponding to the same-index widemeasure in widemeasures

Entries that are NA in the list will not be used

If neither data_cols nor id_cols are specified, user must provide arguments to tidyr::pivot_longer via ... for at least the cols argument and these arguments provided via ... will be used for all widemeasures data.frame's

names_to, values_to

Specifies the output column names created by tidyr::pivot_longer. Each can be provided as vectors the same length as widemeasures Note that if neither data_cols nor id_cols

values_to_numeric

logical indicating whether values will be coerced to numeric. See below for when this may be overridden by arguments passed in ...

...

Other functions to be passed to pivot_longer Note that including values_transform here will override the behavior of values_to_numeric

Value

Pivoted longer data.frame (if widemeasures is a single data.frame) or list of pivoted longer data.frame's (if widemeasures is a list of data.frame's)