getMeta | R Documentation |
Functions for extracting and adding metadata for objects of class TD.
getMeta
extracts a data.frame with location, date, design, latitude,
longitude, plot width and plot length for all trials in TD.
setMeta
adds metadata from a data.frame to an object of class TD. See
details for the specifications of the data.frame.
The most common use case is extracting metadata from a TD object, modifying
the content and then adding it back to the TD object.
Information in the metadata of a TD object is used in plotting functions
(e.g. latitude and longitude for a map plot) and when fitting models on the
data (the trial design).
getMeta(TD)
setMeta(TD, meta)
TD |
An object of class TD. |
meta |
A data.frame containing metadata. |
When setting metadata, metadata has to be a data.frame with rownames
corresponding to the trials in TD
. The data.frame should contain one
or more of the following columns:
The location of the trial. Used as default name when creating plots and summaries.
The date of the trial.
The design of the trial. One of "none" (no (known) design), "ibd" (incomplete-block design), "res.ibd" (resolvable incomplete-block design), "rcbd" (randomized complete block design), "rowcol" (row-column design) or "res.rowcol" (resolvable row-column design). Used when fitting models.
The latitude of the trial on a scale of -90 to 90. Used when plotting the trials on a map.
The longitude of the trial on a scale of -180 to 180. Used when plotting the trials on a map.
The width of the plot. Used in combination with trPlLength to determine the size of the plots in a layout plot of a trial.
The length of the plot. Used in combination with trPlWidth to determine the size of the plots in a layout plot of a trial.
The values of the metadata of TD will be set to the values in the
corresponding column in meta
. Existing values will be overwritten,
but NA
will be ignored so setting a value to NA
won't result
in accidentally removing it.
Other functions for TD objects:
TD
,
plot.TD()
,
summary.TD()
data("dropsRaw")
## Create a TD object.
dropsTD <- createTD(data = dropsRaw[dropsRaw$year == 2012, ],
genotype = "Variety_ID",
trial = "Experiment",
loc = "Site",
repId = "Replicate",
subBlock = "block",
rowCoord = "Row",
colCoord = "Column",
trLat = "Lat",
trLong = "Long")
## Get meta data from dropsTD.
(dropsMeta <- getMeta(dropsTD))
## Add trial date to meta data.
dropsMeta$trDate <- as.Date(rep("010112", times = 5), "%d%m%y")
## Add back meta data to wheatTD.
dropsTD <- setMeta(dropsTD,
dropsMeta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.