@@ -5,6 +5,15 @@ path_uv <- "testdata/dad1.uv" #chemstation 131
5
5
6
6
x <- read_chroms(path_csv , format_in = " chemstation_csv" , progress_bar = FALSE )[[1 ]]
7
7
8
+ test_that(" chromconverter can read `Agilent Chemstation` csv file" , {
9
+ expect_equal(dim(x ), c(1944 , 1 ))
10
+ expect_equal(head(x [,1 ], n = 3 ), c(- 4.086018 , - 4.113674 , - 4.142761 ),
11
+ tolerance = .0001 , ignore_attr = TRUE )
12
+ expect_equal(head(rownames(x ), n = 3 ), c(" 0.002" , " 0.0086666666667" ,
13
+ " 0.0153333333333" ))
14
+
15
+ })
16
+
8
17
test_that(" Aston parser can read `Agilent Chemstation` 131 files" , {
9
18
skip_if_missing_dependencies()
10
19
skip_if_not(file.exists(path_csv ))
@@ -26,14 +35,13 @@ test_that("Aston parser can read `Agilent Chemstation` 131 files", {
26
35
27
36
x1 <- read_chroms(path_uv , format_in = " chemstation_uv" , parser = " chromconverter" ,
28
37
find_files = FALSE ,
29
- read_metadata = TRUE , progress_bar = FALSE )
38
+ read_metadata = TRUE , progress_bar = FALSE )[[ 1 ]]
30
39
31
40
test_that(" read_chemstation_uv parser can read chemstation 131 files" , {
32
- expect_equal(as.numeric(x [[1 ]][,1 ]), as.numeric(x1 [[1 ]][," 220" ]))
33
- expect_equal(as.numeric(rownames(x [[1 ]])), as.numeric(rownames(x1 [[1 ]])))
34
- expect_equal(length(x1 ), length(path_uv ))
35
- expect_equal(class(x1 [[1 ]])[1 ], " matrix" )
36
- expect_equal(attr(x1 [[1 ]], " data_format" ), " wide" )
41
+ expect_equal(as.numeric(x [,1 ]), as.numeric(x1 [," 220" ]))
42
+ expect_equal(as.numeric(rownames(x )), as.numeric(rownames(x1 )))
43
+ expect_equal(class(x1 )[1 ], " matrix" )
44
+ expect_equal(attr(x1 , " data_format" ), " wide" )
37
45
})
38
46
39
47
test_that(" extract_metadata function works" , {
@@ -51,13 +59,13 @@ test_that("entab parser can read `Agilent Chemstation` 131 files", {
51
59
52
60
x1 <- read_chroms(file , format_in = " chemstation_uv" , parser = " entab" ,
53
61
find_files = FALSE ,
54
- read_metadata = TRUE , progress_bar = FALSE )
62
+ read_metadata = TRUE , progress_bar = FALSE )[[ 1 ]]
55
63
56
- expect_equal(as.numeric(x [[ 1 ]][ ,1 ]), as.numeric(x1 [[ 1 ]] [," 220" ]))
57
- expect_equal(as.numeric(rownames(x [[ 1 ]] )), as.numeric(rownames(x1 [[ 1 ]] )))
58
- expect_equal(class(x1 [[ 1 ]] )[1 ], " matrix" )
59
- expect_equal(attr(x1 [[ 1 ]] , " parser" ), " entab" )
60
- expect_equal(attr(x1 [[ 1 ]] , " data_format" ), " wide" )
64
+ expect_equal(as.numeric(x [,1 ]), as.numeric(x1 [," 220" ]))
65
+ expect_equal(as.numeric(rownames(x )), as.numeric(rownames(x1 )))
66
+ expect_equal(class(x1 )[1 ], " matrix" )
67
+ expect_equal(attr(x1 , " parser" ), " entab" )
68
+ expect_equal(attr(x1 , " data_format" ), " wide" )
61
69
})
62
70
63
71
test_that(" Shimadzu ascii parser works" , {
0 commit comments