2018-12-16 22:45:12 +01:00
|
|
|
# ==================================================================== #
|
|
|
|
# TITLE #
|
|
|
|
# Antimicrobial Resistance (AMR) Analysis #
|
|
|
|
# #
|
2019-01-02 23:24:07 +01:00
|
|
|
# SOURCE #
|
|
|
|
# https://gitlab.com/msberends/AMR #
|
2018-12-16 22:45:12 +01:00
|
|
|
# #
|
|
|
|
# LICENCE #
|
2020-01-05 17:22:09 +01:00
|
|
|
# (c) 2018-2020 Berends MS, Luz CF et al. #
|
2018-12-16 22:45:12 +01:00
|
|
|
# #
|
2019-01-02 23:24:07 +01:00
|
|
|
# This R package is free software; you can freely use and distribute #
|
|
|
|
# it for both personal and commercial purposes under the terms of the #
|
|
|
|
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
|
|
|
# the Free Software Foundation. #
|
|
|
|
# #
|
2020-01-05 17:22:09 +01:00
|
|
|
# We created this package for both routine data analysis and academic #
|
|
|
|
# research and it was publicly released in the hope that it will be #
|
|
|
|
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
2019-04-05 18:47:39 +02:00
|
|
|
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
|
2018-12-16 22:45:12 +01:00
|
|
|
# ==================================================================== #
|
|
|
|
|
2018-11-19 13:00:22 +01:00
|
|
|
context("read.4d.R")
|
|
|
|
|
|
|
|
test_that("read 4D works", {
|
|
|
|
|
|
|
|
library(dplyr)
|
|
|
|
test1 <- data.frame(Patientnr = "ABC",
|
|
|
|
MV = "M",
|
|
|
|
Monsternr = "0123",
|
|
|
|
Afnamedat = "10-11-12",
|
|
|
|
Bepaling = "bk",
|
|
|
|
Afd. = "ABC",
|
|
|
|
Spec = "ABC",
|
|
|
|
Matbijz. = "ABC",
|
|
|
|
Mat = "ABC",
|
|
|
|
Mocode = "esccol",
|
|
|
|
PENI = "R",
|
|
|
|
stringsAsFactors = FALSE)
|
|
|
|
tf <- tempfile()
|
|
|
|
write.table(test1, file = tf, quote = F, sep = "\t")
|
|
|
|
|
2018-11-24 20:25:09 +01:00
|
|
|
x <- read.4D(tf, skip = 0, info = TRUE)
|
2018-11-19 13:00:22 +01:00
|
|
|
unlink(tf)
|
|
|
|
|
|
|
|
expect_equal(ncol(x), 11)
|
|
|
|
expect_equal(class(x$date_received), "Date")
|
|
|
|
expect_equal(class(x$mo), "mo")
|
2019-09-18 15:46:09 +02:00
|
|
|
expect_equal(as.character(x$mo), "B_ESCHR_COLI")
|
2018-11-19 13:00:22 +01:00
|
|
|
expect_equal(is.rsi(x$peni), TRUE)
|
|
|
|
|
|
|
|
})
|