mirror of
https://github.com/msberends/AMR.git
synced 2026-11-29 08:06:14 +01:00
Built site for AMR@3.0.1.9138: 499b039
This commit is contained in:
1 parent
840ba97370
commit
c3087b8247
152 files changed
+1685
-1369
No files matched your search
@@ -85,31 +85,30 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class <sir>
|
||||
#> [1] S R I R R R R I I I
|
||||
#> [1] S I I I I I R R I R
|
||||
mean_amr_distance(sir)
|
||||
#> [1] -0.9486833 0.9486833 -0.9486833 0.9486833 0.9486833 0.9486833
|
||||
#> [7] 0.9486833 -0.9486833 -0.9486833 -0.9486833
|
||||
#> [1] -0.621059 -0.621059 -0.621059 -0.621059 -0.621059 -0.621059 1.449138
|
||||
#> [8] 1.449138 -0.621059 1.449138
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class <mic>
|
||||
#> [1] 0.032 0.032 0.125 0.25 0.016 0.004 <=0.0005 0.016
|
||||
#> [9] 0.25 0.5
|
||||
#> [1] 0.5 0.008 0.001 0.0001 0.064 0.0002 0.064 0.0001 0.032 1
|
||||
mean_amr_distance(mic)
|
||||
#> [1] -0.02823448 -0.02823448 0.61480238 0.94191703 -0.35534914 -1.00957846
|
||||
#> [7] -1.99092244 -0.35534914 0.94191703 1.26903169
|
||||
#> [1] 1.198191624 0.000686808 -0.601499640 -1.268306334 0.602873256
|
||||
#> [6] -1.067577518 0.602873256 -1.268306334 0.402144440 1.398920440
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] -0.02823448 -0.02823448 0.61480238 0.94191703 -0.35534914 -1.00957846
|
||||
#> [7] -1.99092244 -0.35534914 0.94191703 1.26903169
|
||||
#> [1] 1.198191624 0.000686808 -0.601499640 -1.268306334 0.602873256
|
||||
#> [6] -1.067577518 0.602873256 -1.268306334 0.402144440 1.398920440
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class <disk>
|
||||
#> [1] 48 45 48 40 44 9 39 49 39 29
|
||||
#> [1] 38 37 42 30 40 24 45 36 49 44
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 0.74202711 0.49468474 0.74202711 0.08244746 0.41223728 -2.47342369
|
||||
#> [7] 0.00000000 0.82447456 0.00000000 -0.82447456
|
||||
#> [1] -0.06786705 -0.20360115 0.47506935 -1.15373986 0.20360115 -1.96814446
|
||||
#> [7] 0.88227166 -0.33933525 1.42520806 0.74653756
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -120,35 +119,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A R 26 <=2 >=2
|
||||
#> 2 B R 28 <=2 1
|
||||
#> 3 C R 30 <=2 1
|
||||
#> 4 D R 30 <=2 1
|
||||
#> 5 E I 31 4 1
|
||||
#> 6 F S 28 4 1
|
||||
#> 7 G S 32 <=2 >=2
|
||||
#> 8 H I 25 <=2 1
|
||||
#> 9 I S 21 <=2 1
|
||||
#> 10 J R 20 4 1
|
||||
#> 1 A I 30 16 >=8
|
||||
#> 2 B R 30 <=8 4
|
||||
#> 3 C I 28 <=8 4
|
||||
#> 4 D I 24 <=8 >=8
|
||||
#> 5 E I 28 <=8 4
|
||||
#> 6 F S 30 <=8 4
|
||||
#> 7 G I 28 <=8 4
|
||||
#> 8 H S 31 <=8 >=8
|
||||
#> 9 I R 26 <=8 4
|
||||
#> 10 J I 28 <=8 >=8
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> [1] 0.48908793 0.01826958 0.14037829 0.14037829 0.24464016 0.06147710
|
||||
#> [7] 0.38107241 -0.63923513 -0.88345255 0.04738391
|
||||
#> [1] 1.08474449 0.40297922 -0.42682276 -0.41644967 -0.42682276 -0.18994784
|
||||
#> [7] -0.42682276 0.41261253 -0.07077061 0.05730016
|
||||
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
|
||||
#> 2 B R 28 <=2 1 -0.5477003
|
||||
#> 3 C R 30 <=2 1 -0.5477003
|
||||
#> 4 D R 30 <=2 1 -0.5477003
|
||||
#> 8 H I 25 <=2 1 -0.5477003
|
||||
#> 9 I S 21 <=2 1 -0.5477003
|
||||
#> 5 E I 31 4 1 0.4873980
|
||||
#> 6 F S 28 4 1 0.4873980
|
||||
#> 10 J R 20 4 1 0.4873980
|
||||
#> 1 A R 26 <=2 >=2 0.6381538
|
||||
#> 7 G S 32 <=2 >=2 0.6381538
|
||||
#> 2 B R 30 <=8 4 -0.5454122
|
||||
#> 3 C I 28 <=8 4 -0.5454122
|
||||
#> 5 E I 28 <=8 4 -0.5454122
|
||||
#> 6 F S 30 <=8 4 -0.5454122
|
||||
#> 7 G I 28 <=8 4 -0.5454122
|
||||
#> 9 I R 26 <=8 4 -0.5454122
|
||||
#> 4 D I 24 <=8 >=8 0.4228336
|
||||
#> 8 H S 31 <=8 >=8 0.4228336
|
||||
#> 10 J I 28 <=8 >=8 0.4228336
|
||||
#> 1 A I 30 16 >=8 2.0039724
|
||||
|
||||
if (require("dplyr")) {
|
||||
y %>%
|
||||
@@ -161,16 +160,16 @@ if (require("dplyr")) {
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> id amox cipr gent tobr amr_distance check_id_C
|
||||
#> 1 C R 30 <=2 1 0.14037829 0.00000000
|
||||
#> 2 D R 30 <=2 1 0.14037829 0.00000000
|
||||
#> 3 F S 28 4 1 0.06147710 0.07890119
|
||||
#> 4 J R 20 4 1 0.04738391 0.09299437
|
||||
#> 5 E I 31 4 1 0.24464016 0.10426187
|
||||
#> 6 B R 28 <=2 1 0.01826958 0.12210871
|
||||
#> 7 G S 32 <=2 >=2 0.38107241 0.24069412
|
||||
#> 8 A R 26 <=2 >=2 0.48908793 0.34870964
|
||||
#> 9 H I 25 <=2 1 -0.63923513 0.77961342
|
||||
#> 10 I S 21 <=2 1 -0.88345255 1.02383084
|
||||
#> 1 C I 28 <=8 4 -0.42682276 0.00000000
|
||||
#> 2 E I 28 <=8 4 -0.42682276 0.00000000
|
||||
#> 3 G I 28 <=8 4 -0.42682276 0.00000000
|
||||
#> 4 D I 24 <=8 >=8 -0.41644967 0.01037309
|
||||
#> 5 F S 30 <=8 4 -0.18994784 0.23687492
|
||||
#> 6 I R 26 <=8 4 -0.07077061 0.35605215
|
||||
#> 7 J I 28 <=8 >=8 0.05730016 0.48412292
|
||||
#> 8 B R 30 <=8 4 0.40297922 0.82980198
|
||||
#> 9 H S 31 <=8 >=8 0.41261253 0.83943529
|
||||
#> 10 A I 30 16 >=8 1.08474449 1.51156725
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in new issue
Block a user