mirror of
https://github.com/msberends/AMR.git
synced 2026-03-16 02:47:52 +01:00
Built site for AMR@3.0.1.9030: e2102c0
This commit is contained in:
@@ -85,31 +85,31 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class 'sir'
|
||||
#> [1] R I R I I S R S I I
|
||||
#> [1] S R S R I I R R R S
|
||||
mean_amr_distance(sir)
|
||||
#> [1] 1.449138 -0.621059 1.449138 -0.621059 -0.621059 -0.621059 1.449138
|
||||
#> [8] -0.621059 -0.621059 -0.621059
|
||||
#> [1] -0.9486833 0.9486833 -0.9486833 0.9486833 -0.9486833 -0.9486833
|
||||
#> [7] 0.9486833 0.9486833 0.9486833 -0.9486833
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class 'mic'
|
||||
#> [1] 0.25 0.5 8 2 0.004 4 1 0.001
|
||||
#> [9] 0.004 <=0.0005
|
||||
#> [1] 0.5 <=0.0001 0.25 0.0005 0.001 0.0002 8 <=0.0001
|
||||
#> [9] <=0.0001 0.004
|
||||
mean_amr_distance(mic)
|
||||
#> [1] 0.2626139 0.4520471 1.2097801 0.8309136 -0.8675039 1.0203468
|
||||
#> [7] 0.6414804 -1.2463704 -0.8675039 -1.4358036
|
||||
#> [1] 1.18999891 -0.86809178 1.02250714 -0.47918793 -0.31169616 -0.70060001
|
||||
#> [7] 1.85996599 -0.86809178 -0.86809178 0.02328738
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] 0.2626139 0.4520471 1.2097801 0.8309136 -0.8675039 1.0203468
|
||||
#> [7] 0.6414804 -1.2463704 -0.8675039 -1.4358036
|
||||
#> [1] 1.18999891 -0.86809178 1.02250714 -0.47918793 -0.31169616 -0.70060001
|
||||
#> [7] 1.85996599 -0.86809178 -0.86809178 0.02328738
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class 'disk'
|
||||
#> [1] 49 38 33 31 17 42 43 46 37 46
|
||||
#> [1] 20 45 31 26 23 38 44 41 20 49
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 1.14152462 -0.02113934 -0.54962296 -0.76101641 -2.24077054 0.40164755
|
||||
#> [7] 0.50734427 0.82443445 -0.12683607 0.82443445
|
||||
#> [1] -1.2414143 1.0239402 -0.2446583 -0.6977292 -0.9695717 0.3896410
|
||||
#> [7] 0.9333261 0.6614835 -1.2414143 1.3863970
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -120,35 +120,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A S 28 >=2 8
|
||||
#> 2 B R 33 1 8
|
||||
#> 3 C R 32 1 8
|
||||
#> 4 D I 25 1 16
|
||||
#> 5 E I 19 0.5 16
|
||||
#> 6 F S 23 0.5 8
|
||||
#> 7 G R 27 0.5 16
|
||||
#> 8 H S 29 0.5 8
|
||||
#> 9 I R 32 1 8
|
||||
#> 10 J R 32 0.5 16
|
||||
#> 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
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent",
|
||||
#> and "tobr"
|
||||
#> [1] 0.06974787 0.45859464 0.40418392 0.03309016 -0.65092262 -0.91740267
|
||||
#> [7] 0.25870477 -0.59093836 0.40418392 0.53075837
|
||||
#> [1] 0.52677313 0.16501937 0.34372779 -0.05155946 -0.97765805 0.26901032
|
||||
#> [7] 0.30452889 -0.58337098 0.36899264 -0.36546366
|
||||
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
|
||||
#> 6 F S 23 0.5 8 -0.8163565
|
||||
#> 8 H S 29 0.5 8 -0.8163565
|
||||
#> 2 B R 33 1 8 -0.1012596
|
||||
#> 3 C R 32 1 8 -0.1012596
|
||||
#> 9 I R 32 1 8 -0.1012596
|
||||
#> 5 E I 19 0.5 16 0.1518893
|
||||
#> 7 G R 27 0.5 16 0.1518893
|
||||
#> 10 J R 32 0.5 16 0.1518893
|
||||
#> 1 A S 28 >=2 8 0.6138374
|
||||
#> 4 D I 25 1 16 0.8669863
|
||||
#> 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
|
||||
|
||||
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 R 32 1 8 0.40418392 0.00000000
|
||||
#> 2 I R 32 1 8 0.40418392 0.00000000
|
||||
#> 3 B R 33 1 8 0.45859464 0.05441072
|
||||
#> 4 J R 32 0.5 16 0.53075837 0.12657445
|
||||
#> 5 G R 27 0.5 16 0.25870477 0.14547915
|
||||
#> 6 A S 28 >=2 8 0.06974787 0.33443605
|
||||
#> 7 D I 25 1 16 0.03309016 0.37109376
|
||||
#> 8 H S 29 0.5 8 -0.59093836 0.99512228
|
||||
#> 9 E I 19 0.5 16 -0.65092262 1.05510655
|
||||
#> 10 F S 23 0.5 8 -0.91740267 1.32158659
|
||||
#> 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
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in New Issue
Block a user