mirror of
https://github.com/msberends/AMR.git
synced 2025-12-25 12:30:20 +01:00
Built site for AMR@3.0.1.9007: a5c6aa9
This commit is contained in:
@@ -85,30 +85,30 @@ suspicious.
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
#> Class 'sir'
|
||||
#> [1] I I R I R S S S I S
|
||||
#> [1] R R I R I I S R S I
|
||||
mean_amr_distance(sir)
|
||||
#> [1] -0.4743416 -0.4743416 1.8973666 -0.4743416 1.8973666 -0.4743416
|
||||
#> [7] -0.4743416 -0.4743416 -0.4743416 -0.4743416
|
||||
#> [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.004 2 0.002 0.0001 0.004 0.002 >=4 0.0002 0.032 0.004
|
||||
#> [1] 0.032 0.5 1 >=8 4 0.016 >=8 1 0.004 0.008
|
||||
mean_amr_distance(mic)
|
||||
#> [1] -0.2047915 1.5799751 -0.4038557 -1.2641969 -0.2047915 -0.4038557
|
||||
#> [7] 1.7790393 -1.0651327 0.3924011 -0.2047915
|
||||
#> [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] -0.2047915 1.5799751 -0.4038557 -1.2641969 -0.2047915 -0.4038557
|
||||
#> [7] 1.7790393 -1.0651327 0.3924011 -0.2047915
|
||||
#> [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] 43 12 28 32 22 31 35 25 43 35
|
||||
#> [1] 50 49 38 33 31 17 42 43 46 37
|
||||
mean_amr_distance(disk)
|
||||
#> [1] 1.30998909 -1.96498364 -0.27467513 0.14790199 -0.90854082 0.04225771
|
||||
#> [7] 0.46483484 -0.59160798 1.30998909 0.46483484
|
||||
#> [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],
|
||||
@@ -119,35 +119,35 @@ y <- data.frame(
|
||||
)
|
||||
y
|
||||
#> id amox cipr gent tobr
|
||||
#> 1 A S 31 2 >=16
|
||||
#> 2 B S 27 <=1 8
|
||||
#> 3 C R 25 2 4
|
||||
#> 4 D R 25 <=1 2
|
||||
#> 5 E I 31 <=1 2
|
||||
#> 6 F S 32 <=1 8
|
||||
#> 7 G I 29 2 2
|
||||
#> 8 H S 18 <=1 4
|
||||
#> 9 I S 28 <=1 4
|
||||
#> 10 J R 17 <=1 2
|
||||
#> 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.90606144 -0.03989270 0.66241774 -0.09230226 -0.32300020 0.19914999
|
||||
#> [7] 0.09893189 -0.70734036 -0.22925499 -0.47477055
|
||||
#> [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 25 <=1 2 -0.7848712
|
||||
#> 5 E I 31 <=1 2 -0.7848712
|
||||
#> 10 J R 17 <=1 2 -0.7848712
|
||||
#> 8 H S 18 <=1 4 -0.3105295
|
||||
#> 9 I S 28 <=1 4 -0.3105295
|
||||
#> 2 B S 27 <=1 8 0.1638121
|
||||
#> 6 F S 32 <=1 8 0.1638121
|
||||
#> 7 G I 29 2 2 0.2502272
|
||||
#> 3 C R 25 2 4 0.7245688
|
||||
#> 1 A S 31 2 >=16 1.6732521
|
||||
#> 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 %>%
|
||||
@@ -160,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 25 2 4 0.66241774 0.0000000
|
||||
#> 2 A S 31 2 >=16 0.90606144 0.2436437
|
||||
#> 3 F S 32 <=1 8 0.19914999 0.4632678
|
||||
#> 4 G I 29 2 2 0.09893189 0.5634858
|
||||
#> 5 B S 27 <=1 8 -0.03989270 0.7023104
|
||||
#> 6 D R 25 <=1 2 -0.09230226 0.7547200
|
||||
#> 7 I S 28 <=1 4 -0.22925499 0.8916727
|
||||
#> 8 E I 31 <=1 2 -0.32300020 0.9854179
|
||||
#> 9 J R 17 <=1 2 -0.47477055 1.1371883
|
||||
#> 10 H S 18 <=1 4 -0.70734036 1.3697581
|
||||
#> 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 %>%
|
||||
|
||||
Reference in New Issue
Block a user