JMF R utility functions
Install the latest release from GitHub using pak:
pak::pak("jmf-vienna/jmf-r@*release")
Or install the development version:
pak::pak("jmf-vienna/jmf-r")
library(jmf)
quiet()
library(tidyverse)
Stable combined unique()
and sort()
:
x <- c(
"a", "vector", "of", "strings",
"and", "some", "letters", ":", NA,
"a", "b", "c", "and", "A", "B", "C"
)
x |> uniques()
#> [1] ":" "A" "B" "C" "a" "and" "b"
#> [8] "c" "letters" "of" "some" "strings" "vector" NA
- available (i.e., not
NA
):a()
- not available (i.e.,
NA
):na()
starwars |>
select(name, birth_year, hair_color) |>
filter(a(birth_year), na(hair_color))
#> # A tibble: 4 × 3
#> name birth_year hair_color
#> <chr> <dbl> <chr>
#> 1 C-3PO 112 <NA>
#> 2 R2-D2 33 <NA>
#> 3 Greedo 44 <NA>
#> 4 Jabba Desilijic Tiure 600 <NA>
# valid JMF project ID:
is_jmf_project_id("JMF-2401-42")
#> [1] TRUE
# this is a JMF sample ID:
is_jmf_project_id("JMF-2401-42-0001")
#> [1] FALSE
jmf_project_id_regex(internal = "allow")
#> JMF-(?:(?:(?:(?:19(?:01|02|03|04|05|06|07|08|09|10|11|12|DM|NC|PC))|(?:20(?:01|02|03|04|05|06|07|08|09|10|11|12))|(?:[A-Z]){4})-[1-9A-Z])|(?:(?:(?:2[1-9])|(?:[3-9][0-9]))(?:01|02|03|04|05|06|07|08|09|10|11|12)-(?:(?:0[1-9])|(?:[1-9][0-9]))))