# NOT RUN {
data(FF4_qc) # load demo dataset
QC_num <- FF4_qc[-c(1:5)] # only contain numeric metabolite values.
# target values computed on the whole dataset:
tarVal_1 <- compute_targetVal(QC_num = QC_num,
sampleType = FF4_qc$sampleType,
batchID = FF4_qc$plateID,
targetVal_method = "mean",
targetVal_batchWise = FALSE,
targetVal_removeOutlier = TRUE)
# target values computed on batches:
tarVal_2 <- compute_targetVal(QC_num = QC_num,
sampleType = FF4_qc$sampleType,
batchID = FF4_qc$plateID,
targetVal_method = "mean",
targetVal_batchWise = TRUE,
targetVal_removeOutlier = FALSE)
# If coerce_numeric = TRUE,
# columns cannot be coerced to numeric will be removed (with warnings):
tarVal_3 <- compute_targetVal(QC_num = FF4_qc[-c(4:5)],
sampleType = FF4_qc$sampleType,
batchID = FF4_qc$plateID,
targetVal_method = "mean",
targetVal_batchWise = TRUE,
targetVal_removeOutlier = FALSE,
coerce_numeric = TRUE)
identical(tarVal_2, tarVal_3) # identical to tarVal_2
# }
# NOT RUN {
# will throw errors if input data have non-numeric columns
# and coerce_numeric = FALSE:
tarVal_4 <- compute_targetVal(QC_num = FF4_qc,
sampleType = FF4_qc$sampleType,
batchID = FF4_qc$plateID,
targetVal_method = "mean",
targetVal_batchWise = TRUE,
targetVal_removeOutlier = FALSE,
coerce_numeric = FALSE)
# }
Run the code above in your browser using DataLab