sir <- random_sir(10)
sir
#> Class 'sir'
-#> [1] R S R I I R R R S R
+#> [1] R R I R I I S R S I
mean_amr_distance(sir)
-#> [1] 0.7745967 -1.1618950 0.7745967 -1.1618950 -1.1618950 0.7745967
-#> [7] 0.7745967 0.7745967 -1.1618950 0.7745967
+#> [1] 1.1618950 1.1618950 -0.7745967 1.1618950 -0.7745967 -0.7745967
+#> [7] -0.7745967 1.1618950 -0.7745967 -0.7745967
mic <- random_mic(10)
mic
#> Class 'mic'
-#> [1] 0.25 0.0005 0.001 0.0002 8 <=0.0001 <=0.0001 0.004
-#> [9] 0.016 0.002
+#> [1] 0.032 0.5 1 >=8 4 0.016 >=8 1 0.004 0.008
mean_amr_distance(mic)
-#> [1] 1.17346160 -0.53194487 -0.34173212 -0.78339244 2.12452534 -0.97360519
-#> [7] -0.97360519 0.03869338 0.41911887 -0.15151937
+#> [1] -0.7311752 0.2104422 0.4478776 1.1601837 0.9227483 -0.9686106
+#> [7] 1.1601837 0.4478776 -1.4434813 -1.2060459
# equal to the Z-score of their log2:
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
-#> [1] 1.17346160 -0.53194487 -0.34173212 -0.78339244 2.12452534 -0.97360519
-#> [7] -0.97360519 0.03869338 0.41911887 -0.15151937
+#> [1] -0.7311752 0.2104422 0.4478776 1.1601837 0.9227483 -0.9686106
+#> [7] 1.1601837 0.4478776 -1.4434813 -1.2060459
disk <- random_disk(10)
disk
#> Class 'disk'
-#> [1] 31 26 23 38 44 41 20 49 32 16
+#> [1] 50 49 38 33 31 17 42 43 46 37
mean_amr_distance(disk)
-#> [1] -0.09179851 -0.55079106 -0.82618658 0.55079106 1.10158211 0.82618658
-#> [7] -1.10158211 1.56057466 0.00000000 -1.46877615
+#> [1] 1.15131286 1.05032051 -0.06059541 -0.56555720 -0.76754191 -2.18143490
+#> [7] 0.34337401 0.44436637 0.74734344 -0.16158777
y <- data.frame(
id = LETTERS[1:10],
@@ -145,35 +144,35 @@
)
y
#> id amox cipr gent tobr
-#> 1 A S 27 8 32
-#> 2 B I 33 2 16
-#> 3 C I 22 1 <=4
-#> 4 D R 32 0.25 8
-#> 5 E S 31 8 16
-#> 6 F I 31 2 <=4
-#> 7 G R 28 2 <=4
-#> 8 H S 22 16 8
-#> 9 I I 22 8 16
-#> 10 J I 24 0.25 32
+#> 1 A I 27 >=2 8
+#> 2 B S 28 1 8
+#> 3 C R 33 1 8
+#> 4 D R 32 1 16
+#> 5 E I 25 0.5 16
+#> 6 F I 19 0.5 8
+#> 7 G S 23 0.5 16
+#> 8 H R 27 0.5 8
+#> 9 I S 29 1 8
+#> 10 J R 32 0.5 16
mean_amr_distance(y)
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent",
#> and "tobr"
-#> [1] 0.42546514 0.31178268 -0.85243112 0.27789744 0.43759204 -0.22674498
-#> [7] 0.19734764 -0.16271414 -0.06891128 -0.33928341
+#> [1] 0.08471751 -0.21572693 0.55391610 0.98093500 -0.26046456 -1.08721162
+#> [7] -0.37467261 -0.14625651 -0.15862291 0.62338653
y$amr_distance <- mean_amr_distance(y, is.mic(y))
#> ℹ Calculating mean AMR distance based on columns "gent" and "tobr"
y[order(y$amr_distance), ]
#> id amox cipr gent tobr amr_distance
-#> 4 D R 32 0.25 8 -0.93315862
-#> 3 C I 22 1 <=4 -0.88239870
-#> 6 F I 31 2 <=4 -0.64403306
-#> 7 G R 28 2 <=4 -0.64403306
-#> 10 J I 24 0.25 32 -0.08121587
-#> 2 B I 33 2 16 0.20790970
-#> 8 H S 22 16 8 0.49703526
-#> 5 E S 31 8 16 0.68464099
-#> 9 I I 22 8 16 0.68464099
-#> 1 A S 27 8 32 1.11061237
+#> 6 F I 19 0.5 8 -0.8163565
+#> 8 H R 27 0.5 8 -0.8163565
+#> 2 B S 28 1 8 -0.1012596
+#> 3 C R 33 1 8 -0.1012596
+#> 9 I S 29 1 8 -0.1012596
+#> 5 E I 25 0.5 16 0.1518893
+#> 7 G S 23 0.5 16 0.1518893
+#> 10 J R 32 0.5 16 0.1518893
+#> 1 A I 27 >=2 8 0.6138374
+#> 4 D R 32 1 16 0.8669863
if (require("dplyr")) {
y %>%
@@ -186,16 +185,16 @@
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent",
#> and "tobr"
#> id amox cipr gent tobr amr_distance check_id_C
-#> 1 C I 22 1 <=4 -0.85243112 0.0000000
-#> 2 J I 24 0.25 32 -0.33928341 0.5131477
-#> 3 F I 31 2 <=4 -0.22674498 0.6256861
-#> 4 H S 22 16 8 -0.16271414 0.6897170
-#> 5 I I 22 8 16 -0.06891128 0.7835198
-#> 6 G R 28 2 <=4 0.19734764 1.0497788
-#> 7 D R 32 0.25 8 0.27789744 1.1303286
-#> 8 B I 33 2 16 0.31178268 1.1642138
-#> 9 A S 27 8 32 0.42546514 1.2778963
-#> 10 E S 31 8 16 0.43759204 1.2900232
+#> 1 C R 33 1 8 0.55391610 0.00000000
+#> 2 J R 32 0.5 16 0.62338653 0.06947042
+#> 3 D R 32 1 16 0.98093500 0.42701889
+#> 4 A I 27 >=2 8 0.08471751 0.46919859
+#> 5 H R 27 0.5 8 -0.14625651 0.70017262
+#> 6 I S 29 1 8 -0.15862291 0.71253901
+#> 7 B S 28 1 8 -0.21572693 0.76964304
+#> 8 E I 25 0.5 16 -0.26046456 0.81438066
+#> 9 G S 23 0.5 16 -0.37467261 0.92858871
+#> 10 F I 19 0.5 8 -1.08721162 1.64112773
if (require("dplyr")) {
# support for groups
example_isolates %>%
diff --git a/reference/pca-1.png b/reference/pca-1.png
index 50186dc13..6b532db6c 100644
Binary files a/reference/pca-1.png and b/reference/pca-1.png differ
diff --git a/reference/pca-2.png b/reference/pca-2.png
index 7f58fd8f7..422a548ec 100644
Binary files a/reference/pca-2.png and b/reference/pca-2.png differ
diff --git a/reference/pca-3.png b/reference/pca-3.png
index 16592a7a1..c8634a6e3 100644
Binary files a/reference/pca-3.png and b/reference/pca-3.png differ
diff --git a/reference/plot-1.png b/reference/plot-1.png
index d32f27989..67dc915a1 100644
Binary files a/reference/plot-1.png and b/reference/plot-1.png differ
diff --git a/reference/plot-10.png b/reference/plot-10.png
index e54b68dd9..65c353eea 100644
Binary files a/reference/plot-10.png and b/reference/plot-10.png differ
diff --git a/reference/plot-11.png b/reference/plot-11.png
index 8251241ad..f944a974a 100644
Binary files a/reference/plot-11.png and b/reference/plot-11.png differ
diff --git a/reference/plot-12.png b/reference/plot-12.png
index 2be06214e..a74eeeced 100644
Binary files a/reference/plot-12.png and b/reference/plot-12.png differ
diff --git a/reference/plot-13.png b/reference/plot-13.png
index d5ceb768e..767bea63b 100644
Binary files a/reference/plot-13.png and b/reference/plot-13.png differ
diff --git a/reference/plot-14.png b/reference/plot-14.png
index dcd1fc928..c8b02bbe7 100644
Binary files a/reference/plot-14.png and b/reference/plot-14.png differ
diff --git a/reference/plot-15.png b/reference/plot-15.png
index 4e426ce47..241713145 100644
Binary files a/reference/plot-15.png and b/reference/plot-15.png differ
diff --git a/reference/plot-16.png b/reference/plot-16.png
index 4bde42f42..a06c20a8e 100644
Binary files a/reference/plot-16.png and b/reference/plot-16.png differ
diff --git a/reference/plot-17.png b/reference/plot-17.png
index 07fde5614..4be673ad0 100644
Binary files a/reference/plot-17.png and b/reference/plot-17.png differ
diff --git a/reference/plot-18.png b/reference/plot-18.png
index 48fd92f9c..a90eab3e3 100644
Binary files a/reference/plot-18.png and b/reference/plot-18.png differ
diff --git a/reference/plot-19.png b/reference/plot-19.png
index 836d3011e..918ed7755 100644
Binary files a/reference/plot-19.png and b/reference/plot-19.png differ
diff --git a/reference/plot-2.png b/reference/plot-2.png
index 97f649fae..2f293236a 100644
Binary files a/reference/plot-2.png and b/reference/plot-2.png differ
diff --git a/reference/plot-20.png b/reference/plot-20.png
index 38ca5fe02..d587f5d27 100644
Binary files a/reference/plot-20.png and b/reference/plot-20.png differ
diff --git a/reference/plot-3.png b/reference/plot-3.png
index d6e85c3c6..62dbd73a4 100644
Binary files a/reference/plot-3.png and b/reference/plot-3.png differ
diff --git a/reference/plot-4.png b/reference/plot-4.png
index 1611fd3e5..572aa477b 100644
Binary files a/reference/plot-4.png and b/reference/plot-4.png differ
diff --git a/reference/plot-5.png b/reference/plot-5.png
index 17e45a612..f763b8dbd 100644
Binary files a/reference/plot-5.png and b/reference/plot-5.png differ
diff --git a/reference/plot-6.png b/reference/plot-6.png
index 26d26629e..8199e7a8c 100644
Binary files a/reference/plot-6.png and b/reference/plot-6.png differ
diff --git a/reference/plot-7.png b/reference/plot-7.png
index 8dec4586d..a9140938a 100644
Binary files a/reference/plot-7.png and b/reference/plot-7.png differ
diff --git a/reference/plot-8.png b/reference/plot-8.png
index ed646966b..da96fb536 100644
Binary files a/reference/plot-8.png and b/reference/plot-8.png differ
diff --git a/reference/plot-9.png b/reference/plot-9.png
index da6e8d1d8..91c88d22b 100644
Binary files a/reference/plot-9.png and b/reference/plot-9.png differ
diff --git a/reference/random-1.png b/reference/random-1.png
index 2748ad23f..cd6ff3e24 100644
Binary files a/reference/random-1.png and b/reference/random-1.png differ
diff --git a/reference/random-2.png b/reference/random-2.png
index eb222fc32..b2afd1332 100644
Binary files a/reference/random-2.png and b/reference/random-2.png differ
diff --git a/reference/random.html b/reference/random.html
index 45ff0bc00..4aab6b128 100644
--- a/reference/random.html
+++ b/reference/random.html
@@ -111,16 +111,15 @@
Examples
random_mic(25)
#> Class 'mic'
-#> [1] 0.125 2 16 1 0.004 0.008 0.0005 0.125
-#> [9] 2 0.008 0.008 0.016 0.064 0.064 <=0.0002 0.001
-#> [17] 0.0005 0.5 0.002 0.002 0.125 8 <=0.0002 0.002
-#> [25] 0.064
+#> [1] 1 0.064 2 0.016 128 0.001 0.004 0.008 64 0.064
+#> [11] 0.002 0.001 0.016 0.004 0.0005 0.0005 0.125 0.032 0.032 8
+#> [21] 2 8 0.008 0.0005 8
random_disk(25)
#> Class 'disk'
-#> [1] 47 24 47 38 28 36 33 31 50 41 29 40 31 44 45 37 40 44 49 9 48 20 37 47 28
+#> [1] 46 38 45 47 24 28 45 43 19 23 44 19 31 22 40 39 39 36 35 14 34 45 21 19 39
random_sir(25)
#> Class 'sir'
-#> [1] S R R S S I S I S S I S R I I I I S I R I I I I R
+#> [1] I S R I R I S S S R R R I I R R I S R R S I S R I
# add more skewedness, make more realistic by setting a bug and/or drug:
disks <- random_disk(100, severity = 2, mo = "Escherichia coli", ab = "CIP")
@@ -133,30 +132,28 @@
# \donttest{
random_mic(25, "Klebsiella pneumoniae") # range 0.0625-64
#> Class 'mic'
-#> [1] 0.0005 8 0.008 0.0002 0.0002 0.0002 0.0002 <=0.0001
-#> [9] 64 <=0.0001 1 0.5 0.001 0.5 0.001 0.0005
-#> [17] 0.016 0.008 0.002 0.032 <=0.0001 0.0002 0.001 0.0005
-#> [25] 0.001
+#> [1] 2 0.032 32 0.5 0.001 0.008 0.002 4 0.0005 1
+#> [11] 0.001 1 8 0.002 0.25 2 0.016 0.004 0.25 0.125
+#> [21] 0.002 0.5 0.004 >=256 0.0005
random_mic(25, "Klebsiella pneumoniae", "meropenem") # range 0.0625-16
#> Class 'mic'
-#> [1] <=0.5 <=0.5 2 <=0.5 1 <=0.5 <=0.5 <=0.5 <=0.5 1 <=0.5 <=0.5
-#> [13] <=0.5 1 <=0.5 1 <=0.5 <=0.5 <=0.5 <=0.5 <=0.5 <=0.5 2 1
-#> [25] 2
+#> [1] 4 >=8 4 >=8 4 >=8 4 4 4 4 4 4 >=8 >=8 4 >=8 4 4 4
+#> [20] 4 4 4 4 4 4
random_mic(25, "Streptococcus pneumoniae", "meropenem") # range 0.0625-4
#> Class 'mic'
-#> [1] 0.125 0.125 1 0.25 0.5 0.125 0.125 0.125 0.125 0.125 0.125 0.125
-#> [13] 1 0.125 0.5 1 0.125 0.25 0.5 0.25 0.5 0.5 0.5 0.125
-#> [25] 0.25
+#> [1] <=0.25 0.5 <=0.25 <=0.25 <=0.25 0.5 <=0.25 <=0.25 <=0.25 <=0.25
+#> [11] <=0.25 <=0.25 0.5 <=0.25 <=0.25 <=0.25 0.5 <=0.25 0.5 <=0.25
+#> [21] <=0.25 0.5 <=0.25 0.5 0.5
random_disk(25, "Klebsiella pneumoniae") # range 8-50
#> Class 'disk'
-#> [1] 32 21 23 21 14 22 25 29 29 28 34 34 34 33 13 28 33 34 32 25 18 26 13 21 33
+#> [1] 33 26 16 27 29 33 24 17 17 15 16 26 26 14 17 29 25 25 24 32 32 34 18 31 10
random_disk(25, "Klebsiella pneumoniae", "ampicillin") # range 11-17
#> Class 'disk'
-#> [1] 20 21 15 22 16 22 16 14 21 17 15 19 20 17 18 21 16 20 11 22 19 18 19 11 21
+#> [1] 19 20 11 14 12 12 17 16 12 10 15 22 19 21 19 17 18 19 21 17 21 15 17 12 19
random_disk(25, "Streptococcus pneumoniae", "ampicillin") # range 12-27
#> Class 'disk'
-#> [1] 29 25 31 17 29 21 31 34 33 31 29 30 23 20 33 20 34 32 35 26 26 26 34 30 33
+#> [1] 27 24 31 22 35 28 26 32 24 18 35 33 24 28 33 25 35 25 32 24 26 20 23 22 33
# }
diff --git a/reference/resistance_predict-1.png b/reference/resistance_predict-1.png
index 7b444dec8..44d873a1b 100644
Binary files a/reference/resistance_predict-1.png and b/reference/resistance_predict-1.png differ
diff --git a/reference/resistance_predict-2.png b/reference/resistance_predict-2.png
index 5fb769723..6d9382ddc 100644
Binary files a/reference/resistance_predict-2.png and b/reference/resistance_predict-2.png differ
diff --git a/reference/resistance_predict-3.png b/reference/resistance_predict-3.png
index ae63d27c4..230360e53 100644
Binary files a/reference/resistance_predict-3.png and b/reference/resistance_predict-3.png differ
diff --git a/reference/resistance_predict-4.png b/reference/resistance_predict-4.png
index 8cd50cb57..8bc0c2713 100644
Binary files a/reference/resistance_predict-4.png and b/reference/resistance_predict-4.png differ
diff --git a/reference/skewness.html b/reference/skewness.html
index 600522a7c..2af12d948 100644
--- a/reference/skewness.html
+++ b/reference/skewness.html
@@ -90,7 +90,7 @@ When negative ('left-skewed'): the left tail is longer; the mass of the distribu