forked from Biometris/statgenHTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetTimePoints.R
36 lines (36 loc) · 1.23 KB
/
getTimePoints.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#' Extract time points
#'
#' Function for extracting a data.frame with timeNumbers and timePoints from
#' an object of class TP or fitMod.
#'
#' @param x An object of class TP or fitMod
#'
#' @return A data.frame with columns timeNumber and timePoint listing the
#' time points in x
#'
#' @examples
#' ## Create an object of class TP.
#' phenoTP <- createTimePoints(dat = PhenovatorDat1,
#' experimentName = "Phenovator",
#' genotype = "Genotype",
#' timePoint = "timepoints",
#' repId = "Replicate",
#' plotId = "pos",
#' rowNum = "y", colNum = "x",
#' addCheck = TRUE,
#' checkGenotypes = c("check1", "check2",
#' "check3", "check4"))
#'
#' ## Extract the time points from the object.
#' head(getTimePoints(phenoTP))
#'
#' @family functions for data preparation
#'
#' @export
getTimePoints <- function(x) {
## Check input.
if (!inherits(x, "TP") && !inherits(x, "fitMod")) {
stop("x should be an object of class TP or fitMod")
}
return(attr(x = x, which = "timePoints"))
}