mirror of
https://github.com/msberends/AMR.git
synced 2026-02-09 14:32:54 +01:00
Built site for AMR@3.0.1.9019: ba4c159
This commit is contained in:
@@ -85,30 +85,31 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class 'sir'
|
||||
#> [1] R R I R I I S R S I
|
||||
#> [1] R I R I I S R S I I
|
||||
mean_amr_distance(sir)
|
||||
#> [1] 1.1618950 1.1618950 -0.7745967 1.1618950 -0.7745967 -0.7745967
|
||||
#> [7] -0.7745967 1.1618950 -0.7745967 -0.7745967
|
||||
#> [1] 1.449138 -0.621059 1.449138 -0.621059 -0.621059 -0.621059 1.449138
|
||||
#> [8] -0.621059 -0.621059 -0.621059
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
#> Class 'mic'
|
||||
#> [1] 0.032 0.5 1 >=8 4 0.016 >=8 1 0.004 0.008
|
||||
#> [1] 0.25 0.5 8 2 0.004 4 1 0.001
|
||||
#> [9] 0.004 <=0.0005
|
||||
mean_amr_distance(mic)
|
||||
#> [1] -0.7311752 0.2104422 0.4478776 1.1601837 0.9227483 -0.9686106
|
||||
#> [7] 1.1601837 0.4478776 -1.4434813 -1.2060459
|
||||
#> [1] 0.2626139 0.4520471 1.2097801 0.8309136 -0.8675039 1.0203468
|
||||
#> [7] 0.6414804 -1.2463704 -0.8675039 -1.4358036
|
||||
# equal to the Z-score of their log2:
|
||||
(log2(mic) - mean(log2(mic))) / sd(log2(mic))
|
||||
#> [1] -0.7311752 0.2104422 0.4478776 1.1601837 0.9227483 -0.9686106
|
||||
#> [7] 1.1601837 0.4478776 -1.4434813 -1.2060459
|
||||
#> [1] 0.2626139 0.4520471 1.2097801 0.8309136 -0.8675039 1.0203468
|
||||
#> [7] 0.6414804 -1.2463704 -0.8675039 -1.4358036
|
||||
|
||||
disk <- random_disk(10)
|
||||
disk
|
||||
#> Class 'disk'
|
||||
#> [1] 50 49 38 33 31 17 42 43 46 37
|
||||
#> [1] 49 38 33 31 17 42 43 46 37 46
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 1.15131286 1.05032051 -0.06059541 -0.56555720 -0.76754191 -2.18143490
|
||||
#> [7] 0.34337401 0.44436637 0.74734344 -0.16158777
|
||||
#> [1] 1.14152462 -0.02113934 -0.54962296 -0.76101641 -2.24077054 0.40164755
|
||||
#> [7] 0.50734427 0.82443445 -0.12683607 0.82443445
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
@@ -119,35 +120,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 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
|
||||
#> 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
|
||||
mean_amr_distance(y)
|
||||
#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent",
|
||||
#> and "tobr"
|
||||
#> [1] 0.08471751 -0.21572693 0.55391610 0.98093500 -0.26046456 -1.08721162
|
||||
#> [7] -0.37467261 -0.14625651 -0.15862291 0.62338653
|
||||
#> [1] 0.06974787 0.45859464 0.40418392 0.03309016 -0.65092262 -0.91740267
|
||||
#> [7] 0.25870477 -0.59093836 0.40418392 0.53075837
|
||||
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 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
|
||||
#> 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 I 27 >=2 8 0.6138374
|
||||
#> 4 D R 32 1 16 0.8669863
|
||||
#> 1 A S 28 >=2 8 0.6138374
|
||||
#> 4 D I 25 1 16 0.8669863
|
||||
|
||||
if (require("dplyr")) {
|
||||
y %>%
|
||||
@@ -160,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 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
|
||||
#> 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
|
||||
if (require("dplyr")) {
|
||||
# support for groups
|
||||
example_isolates %>%
|
||||
|
||||
Reference in New Issue
Block a user