mirror of
https://github.com/msberends/AMR.git
synced 2026-06-24 08:56:21 +02:00
Built site for AMR@3.0.1.9061: 0c1709c
This commit is contained in:
@@ -85,31 +85,31 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class <sir>
|
||||
#> [1] S R S R I I R R R S
|
||||
#> [1] S S I S I S I S 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.3162278 -0.3162278 -0.3162278 -0.3162278 -0.3162278 -0.3162278
|
||||
#> [7] -0.3162278 -0.3162278 -0.3162278 2.8460499
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class <mic>
|
||||
#> [1] 0.5 <=0.0001 0.25 0.0005 0.001 0.0002 8 <=0.0001
|
||||
#> [9] <=0.0001 0.004
|
||||
#> [1] <=0.0001 0.0002 0.5 0.0005 0.004 0.001 0.016 0.0002
|
||||
#> [9] 0.032 1
|
||||
mean_amr_distance(mic)
|
||||
#> [1] 1.18999891 -0.86809178 1.02250714 -0.47918793 -0.31169616 -0.70060001
|
||||
#> [7] 1.85996599 -0.86809178 -0.86809178 0.02328738
|
||||
#> [1] -1.13933320 -0.92906618 1.44436742 -0.65110831 -0.02030726 -0.44084129
|
||||
#> [7] 0.40022677 -0.92906618 0.61049379 1.65463443
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] 1.18999891 -0.86809178 1.02250714 -0.47918793 -0.31169616 -0.70060001
|
||||
#> [7] 1.85996599 -0.86809178 -0.86809178 0.02328738
|
||||
#> [1] -1.13933320 -0.92906618 1.44436742 -0.65110831 -0.02030726 -0.44084129
|
||||
#> [7] 0.40022677 -0.92906618 0.61049379 1.65463443
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class <disk>
|
||||
#> [1] 20 45 31 26 23 38 44 41 20 49
|
||||
#> [1] 49 30 42 50 16 27 12 13 28 32
|
||||
mean_amr_distance(disk)
|
||||
#> [1] -1.2414143 1.0239402 -0.2446583 -0.6977292 -0.9695717 0.3896410
|
||||
#> [7] 0.9333261 0.6614835 -1.2414143 1.3863970
|
||||
#> [1] 1.37726856 0.00721083 0.87251045 1.44937686 -1.00230539 -0.20911407
|
||||
#> [7] -1.29073860 -1.21863029 -0.13700577 0.15142743
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -120,35 +120,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A R 33 16 <=1
|
||||
#> 2 B S 32 <=8 32
|
||||
#> 3 C S 27 16 32
|
||||
#> 4 D I 33 <=8 8
|
||||
#> 5 E I 22 <=8 2
|
||||
#> 6 F R 32 <=8 4
|
||||
#> 7 G S 31 16 8
|
||||
#> 8 H I 31 <=8 <=1
|
||||
#> 9 I R 28 16 2
|
||||
#> 10 J S 22 16 4
|
||||
#> 1 A I 32 4 8
|
||||
#> 2 B R 32 4 8
|
||||
#> 3 C I 30 8 8
|
||||
#> 4 D S 16 4 8
|
||||
#> 5 E S 33 4 16
|
||||
#> 6 F R 32 4 8
|
||||
#> 7 G I 29 8 8
|
||||
#> 8 H I 31 8 16
|
||||
#> 9 I I 30 4 16
|
||||
#> 10 J R 20 8 8
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent", and
|
||||
#> "tobr"
|
||||
#> [1] 0.52677313 0.16501937 0.34372779 -0.05155946 -0.97765805 0.26901032
|
||||
#> [7] 0.30452889 -0.58337098 0.36899264 -0.36546366
|
||||
#> [1] -0.351732344 0.165816825 0.045278388 -1.048629829 0.209372918
|
||||
#> [6] 0.165816825 0.001722296 0.606383651 0.078704640 0.127266630
|
||||
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
|
||||
#> 8 H I 31 <=8 <=1 -1.0808937
|
||||
#> 5 E I 22 <=8 2 -0.8051882
|
||||
#> 6 F R 32 <=8 4 -0.5294827
|
||||
#> 4 D I 33 <=8 8 -0.2537773
|
||||
#> 1 A R 33 16 <=1 -0.1322104
|
||||
#> 9 I R 28 16 2 0.1434951
|
||||
#> 2 B S 32 <=8 32 0.2976337
|
||||
#> 10 J S 22 16 4 0.4192006
|
||||
#> 7 G S 31 16 8 0.6949060
|
||||
#> 3 C S 27 16 32 1.2463170
|
||||
#> 1 A I 32 4 8 -0.6978278
|
||||
#> 2 B R 32 4 8 -0.6978278
|
||||
#> 4 D S 16 4 8 -0.6978278
|
||||
#> 6 F R 32 4 8 -0.6978278
|
||||
#> 3 C I 30 8 8 0.2704180
|
||||
#> 7 G I 29 8 8 0.2704180
|
||||
#> 10 J R 20 8 8 0.2704180
|
||||
#> 5 E S 33 4 16 0.3372705
|
||||
#> 9 I I 30 4 16 0.3372705
|
||||
#> 8 H I 31 8 16 1.3055163
|
||||
|
||||
if (require("dplyr")) {
|
||||
y %>%
|
||||
@@ -161,16 +161,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 S 27 16 32 0.34372779 0.00000000
|
||||
#> 2 I R 28 16 2 0.36899264 0.02526485
|
||||
#> 3 G S 31 16 8 0.30452889 0.03919890
|
||||
#> 4 F R 32 <=8 4 0.26901032 0.07471748
|
||||
#> 5 B S 32 <=8 32 0.16501937 0.17870842
|
||||
#> 6 A R 33 16 <=1 0.52677313 0.18304534
|
||||
#> 7 D I 33 <=8 8 -0.05155946 0.39528726
|
||||
#> 8 J S 22 16 4 -0.36546366 0.70919145
|
||||
#> 9 H I 31 <=8 <=1 -0.58337098 0.92709877
|
||||
#> 10 E I 22 <=8 2 -0.97765805 1.32138584
|
||||
#> 1 C I 30 8 8 0.045278388 0.00000000
|
||||
#> 2 I I 30 4 16 0.078704640 0.03342625
|
||||
#> 3 G I 29 8 8 0.001722296 0.04355609
|
||||
#> 4 J R 20 8 8 0.127266630 0.08198824
|
||||
#> 5 B R 32 4 8 0.165816825 0.12053844
|
||||
#> 6 F R 32 4 8 0.165816825 0.12053844
|
||||
#> 7 E S 33 4 16 0.209372918 0.16409453
|
||||
#> 8 A I 32 4 8 -0.351732344 0.39701073
|
||||
#> 9 H I 31 8 16 0.606383651 0.56110526
|
||||
#> 10 D S 16 4 8 -1.048629829 1.09390822
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in New Issue
Block a user