t3_in_out: Convert between T3 input and output formats

View source: R/t3_in_out.R

t3_in_outR Documentation

Convert between T3 input and output formats

Description

Convert between T3 input and output formats

Usage

t3_in_out(df, direction = "io")

Arguments

df

A dataframe containing either phenotypic data for import into the T3 database (see details), or phenotypic data exported from T3

direction

String consisting of either "io" indicating that a dataframe in T3 input format has been supplied, and a dataframe in T3 export format should be supplied, or "oi" for the reverse conversion.

Details

The T3 database https://wheat.triticeaetoolbox.org is a public Breedbase (https://breedbase.org) instance focusing on data collected from wheat, barley, and oats. T3 uses upload templates (explained at https://notes.triticeaetoolbox.org/s/h4qRqAfhe#trials-) for loading new data into the database. However, the data that is exported from the database has different column headers. This function is intended to convert between the input and output formats of the database. In lieu of any sort of dictionary object type in R, here we use a dataframe of key-value pairs to perform the substitution. This dataframe is hardcoded into the function. Note that not all columns in the T3 input format are represented in the output format. For more general key-value swapping in R, a function such as plyr::mapvalues() is useful and much more performant than this function.

Value

A list containing the following elements:

  • df The updated dataframe

  • notpresent A vector containing the keys (column names of the input dataframe) that have no corresponding values (column names to translate to in the output dataframe)


etnite/bwardr documentation built on Jan. 6, 2023, 7:12 a.m.