
Read and convert phenotype data into TASSEL 5 phenotype objects
Source:R/class_tassel_phenotype.R
readPhenotype.Rd
This function reads phenotype data from either a file path or a data frame.
Details
If
x
is a character string, the function assumes it is a file path and callsreadPhenotypeFromFile(x)
.If
x
is a data frame, the function requires theattr
parameter to provide metadata and callsreadPhenotypeFromDf(x, attr)
.If
x
is neither a character string nor a data frame, the function throws an error.
Examples
if (FALSE) { # \dontrun{
# Reading phenotype data from a file
phenotype <- readPhenotype("path/to/phenotype/file.txt")
# Reading phenotype data from a data frame
attrDf <- tibble::tribble(
~"col_id", ~"tassel_attr",
"taxa_id", "taxa",
"plant_height", "data",
"PC1", "covariate",
"yield", "data",
)
df <- tibble::tribble(
~"taxa_id", ~"plant_height", ~"PC1", ~"yield",
"line_a", 12.3, 0.5, 2,
"line_b", 22.8, -1.5, 3,
)
phenotypeDf <- readPhenotype(df, attr = attrDf)
} # }