mirror of
https://github.com/msberends/AMR.git
synced 2026-06-24 07:36:21 +02:00
Built site for AMR@3.0.1.9061: 0c1709c
This commit is contained in:
@@ -59,37 +59,40 @@ a [data.frame](https://rdrr.io/r/base/data.frame.html)
|
||||
|
||||
## Details
|
||||
|
||||
\*\*Note:\*\* As opposed to the \`join()\` functions of \`dplyr\`,
|
||||
\[character\] vectors are supported and at default existing columns will
|
||||
get a suffix \`"2"\` and the newly joined columns will not get a suffix.
|
||||
**Note:** As opposed to the `join()` functions of `dplyr`,
|
||||
[character](https://rdrr.io/r/base/character.html) vectors are supported
|
||||
and at default existing columns will get a suffix `"2"` and the newly
|
||||
joined columns will not get a suffix.
|
||||
|
||||
If the \`dplyr\` package is installed, their join functions will be
|
||||
used. Otherwise, the much slower \[merge()\] and \[interaction()\]
|
||||
functions from base R will be used.
|
||||
If the `dplyr` package is installed, their join functions will be used.
|
||||
Otherwise, the much slower
|
||||
[`merge()`](https://rdrr.io/pkg/data.table/man/merge.html) and
|
||||
[`interaction()`](https://rdrr.io/r/base/interaction.html) functions
|
||||
from base R will be used.
|
||||
|
||||
## Examples
|
||||
|
||||
``` r
|
||||
left_join_microorganisms(as.mo("K. pneumoniae"))
|
||||
#> # A tibble: 1 × 26
|
||||
#> mo fullname status kingdom phylum class order family genus species
|
||||
#> <mo> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 B_KLBSL_PNMN Klebsiell… accep… Bacter… Pseud… Gamm… Ente… Enter… Kleb… pneumo…
|
||||
#> # ℹ 16 more variables: subspecies <chr>, rank <chr>, ref <chr>,
|
||||
#> # oxygen_tolerance <chr>, source <chr>, lpsn <chr>, lpsn_parent <chr>,
|
||||
#> # lpsn_renamed_to <chr>, mycobank <chr>, mycobank_parent <chr>,
|
||||
#> # mycobank_renamed_to <chr>, gbif <chr>, gbif_parent <chr>,
|
||||
#> # gbif_renamed_to <chr>, prevalence <dbl>, snomed <list>
|
||||
#> # A tibble: 1 × 28
|
||||
#> mo fullname status domain kingdom phylum class order family genus
|
||||
#> <mo> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 B_KLBSL_PNMN Klebsiella… accep… Bacte… Pseudo… Pseud… Gamm… Ente… Enter… Kleb…
|
||||
#> # ℹ 18 more variables: species <chr>, subspecies <chr>, rank <chr>, ref <chr>,
|
||||
#> # oxygen_tolerance <chr>, morphology <chr>, source <chr>, lpsn <chr>,
|
||||
#> # lpsn_parent <chr>, lpsn_renamed_to <chr>, mycobank <chr>,
|
||||
#> # mycobank_parent <chr>, mycobank_renamed_to <chr>, gbif <chr>,
|
||||
#> # gbif_parent <chr>, gbif_renamed_to <chr>, prevalence <dbl>, snomed <list>
|
||||
left_join_microorganisms("B_KLBSL_PNMN")
|
||||
#> # A tibble: 1 × 26
|
||||
#> mo fullname status kingdom phylum class order family genus species
|
||||
#> <mo> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 B_KLBSL_PNMN Klebsiell… accep… Bacter… Pseud… Gamm… Ente… Enter… Kleb… pneumo…
|
||||
#> # ℹ 16 more variables: subspecies <chr>, rank <chr>, ref <chr>,
|
||||
#> # oxygen_tolerance <chr>, source <chr>, lpsn <chr>, lpsn_parent <chr>,
|
||||
#> # lpsn_renamed_to <chr>, mycobank <chr>, mycobank_parent <chr>,
|
||||
#> # mycobank_renamed_to <chr>, gbif <chr>, gbif_parent <chr>,
|
||||
#> # gbif_renamed_to <chr>, prevalence <dbl>, snomed <list>
|
||||
#> # A tibble: 1 × 28
|
||||
#> mo fullname status domain kingdom phylum class order family genus
|
||||
#> <mo> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 B_KLBSL_PNMN Klebsiella… accep… Bacte… Pseudo… Pseud… Gamm… Ente… Enter… Kleb…
|
||||
#> # ℹ 18 more variables: species <chr>, subspecies <chr>, rank <chr>, ref <chr>,
|
||||
#> # oxygen_tolerance <chr>, morphology <chr>, source <chr>, lpsn <chr>,
|
||||
#> # lpsn_parent <chr>, lpsn_renamed_to <chr>, mycobank <chr>,
|
||||
#> # mycobank_parent <chr>, mycobank_renamed_to <chr>, gbif <chr>,
|
||||
#> # gbif_parent <chr>, gbif_renamed_to <chr>, prevalence <dbl>, snomed <list>
|
||||
|
||||
df <- data.frame(
|
||||
date = seq(
|
||||
@@ -109,14 +112,15 @@ colnames(df)
|
||||
df_joined <- left_join_microorganisms(df, "bacteria")
|
||||
colnames(df_joined)
|
||||
#> [1] "date" "bacteria" "fullname"
|
||||
#> [4] "status" "kingdom" "phylum"
|
||||
#> [7] "class" "order" "family"
|
||||
#> [10] "genus" "species" "subspecies"
|
||||
#> [13] "rank" "ref" "oxygen_tolerance"
|
||||
#> [16] "source" "lpsn" "lpsn_parent"
|
||||
#> [19] "lpsn_renamed_to" "mycobank" "mycobank_parent"
|
||||
#> [22] "mycobank_renamed_to" "gbif" "gbif_parent"
|
||||
#> [25] "gbif_renamed_to" "prevalence" "snomed"
|
||||
#> [4] "status" "domain" "kingdom"
|
||||
#> [7] "phylum" "class" "order"
|
||||
#> [10] "family" "genus" "species"
|
||||
#> [13] "subspecies" "rank" "ref"
|
||||
#> [16] "oxygen_tolerance" "morphology" "source"
|
||||
#> [19] "lpsn" "lpsn_parent" "lpsn_renamed_to"
|
||||
#> [22] "mycobank" "mycobank_parent" "mycobank_renamed_to"
|
||||
#> [25] "gbif" "gbif_parent" "gbif_renamed_to"
|
||||
#> [28] "prevalence" "snomed"
|
||||
|
||||
# \donttest{
|
||||
if (require("dplyr")) {
|
||||
@@ -141,13 +145,14 @@ if (require("dplyr")) {
|
||||
#> [40] "IPM" "MEM" "MTR"
|
||||
#> [43] "CHL" "COL" "MUP"
|
||||
#> [46] "RIF" "fullname" "status"
|
||||
#> [49] "kingdom" "phylum" "class"
|
||||
#> [52] "order" "family" "genus"
|
||||
#> [55] "species" "subspecies" "rank"
|
||||
#> [58] "ref" "oxygen_tolerance" "source"
|
||||
#> [61] "lpsn" "lpsn_parent" "lpsn_renamed_to"
|
||||
#> [64] "mycobank" "mycobank_parent" "mycobank_renamed_to"
|
||||
#> [67] "gbif" "gbif_parent" "gbif_renamed_to"
|
||||
#> [70] "prevalence" "snomed"
|
||||
#> [49] "domain" "kingdom" "phylum"
|
||||
#> [52] "class" "order" "family"
|
||||
#> [55] "genus" "species" "subspecies"
|
||||
#> [58] "rank" "ref" "oxygen_tolerance"
|
||||
#> [61] "morphology" "source" "lpsn"
|
||||
#> [64] "lpsn_parent" "lpsn_renamed_to" "mycobank"
|
||||
#> [67] "mycobank_parent" "mycobank_renamed_to" "gbif"
|
||||
#> [70] "gbif_parent" "gbif_renamed_to" "prevalence"
|
||||
#> [73] "snomed"
|
||||
# }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user