View source: R/writeBiokitSampleAnnotation.R
checkBiokitSampleAnnotation | R Documentation |
Check sample annotation data.frame or tibble meets the requirement of the biokit pipeline
checkBiokitSampleAnnotation(df)
df |
Sample annotation, can be either a |
Invisible NULL
if the requirement is met, otherwise an error
is printed and the function stops
The biokit pipeline requires that values in each column contain no empty spaces. This function ensures that.
writeBiokitSampleAnnotation
, which calls this
function to ensure that the sample annotation file is ok
test <- data.frame(Char=LETTERS[1:6],
Integer=1:6,
Number=pi*1:6,
Factor=gl(2,3, labels = c("level 1", "level 2")), stringsAsFactors=FALSE)
testthat::expect_error(checkBiokitSampleAnnotation(test),
regexp = "level 1.*level 2")
testFix <- data.frame(Char=LETTERS[1:6],
Integer=1:6,
Number=pi*1:6,
Factor=gl(2,3, labels = c("level1", "level2")), stringsAsFactors=FALSE)
testthat::expect_silent(checkBiokitSampleAnnotation(testFix))
if(require("tibble")) {
testthat::expect_error(checkBiokitSampleAnnotation(tibble::as_tibble(test)),
regexp = "level 1.*level 2")
testthat::expect_silent(checkBiokitSampleAnnotation(tibble::as_tibble(testFix)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.