t3_in_out | R Documentation |
Convert between T3 input and output formats
t3_in_out(df, direction = "io")
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. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.