mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 07:26:13 +01:00
add XPT files for SAS software
This commit is contained in:
parent
91fa73dedf
commit
8179092c57
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 2.0.0.9015
|
||||
Date: 2023-05-11
|
||||
Date: 2023-05-12
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
|
2
NEWS.md
2
NEWS.md
@ -10,6 +10,8 @@
|
||||
* Added microbial codes for Gram-negative/positive anaerobic bacteria
|
||||
* `mo_rank()` now returns `NA` for 'unknown' microorganisms (`B_ANAER`, `B_ANAER-NEG`, `B_ANAER-POS`, `B_GRAMN`, `B_GRAMP`, `F_FUNGUS`, `F_YEAST`, and `UNKNOWN`)
|
||||
* Fixed a bug for `as.mo()` that led to coercion of `NA` values when using custom microorganism codes
|
||||
* Added SAS Transport files (file extension `.xpt`) to [our download page](https://msberends.github.io/AMR/articles/datasets.html) to use in SAS software
|
||||
|
||||
|
||||
# AMR 2.0.0
|
||||
|
||||
|
@ -366,7 +366,7 @@ if (changed_md5(clin_break)) {
|
||||
write_md5(clin_break)
|
||||
try(saveRDS(clin_break, "data-raw/clinical_breakpoints.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(clin_break, "data-raw/clinical_breakpoints.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(clin_break, "data-raw/clinical_breakpoints.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(clin_break, "data-raw/clinical_breakpoints.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
|
||||
try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
|
||||
@ -382,7 +382,7 @@ if (changed_md5(microorganisms)) {
|
||||
mo <- microorganisms
|
||||
mo$snomed <- max_50_snomed
|
||||
mo <- dplyr::mutate_if(mo, ~ !is.numeric(.), as.character)
|
||||
try(haven::write_sas(mo, "data-raw/microorganisms.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(mo, "data-raw/microorganisms.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(mo, "data-raw/microorganisms.sav"), silent = TRUE)
|
||||
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
|
||||
mo_all_snomed <- microorganisms %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||
@ -397,7 +397,7 @@ if (changed_md5(ab)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(ab)
|
||||
try(saveRDS(antibiotics, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(haven::write_sas(ab, "data-raw/antibiotics.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(ab, "data-raw/antibiotics.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(ab, "data-raw/antibiotics.sav"), silent = TRUE)
|
||||
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
|
||||
ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||
@ -412,7 +412,7 @@ if (changed_md5(av)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antivirals')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(av)
|
||||
try(saveRDS(antivirals, "data-raw/antivirals.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(haven::write_sas(av, "data-raw/antivirals.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(av, "data-raw/antivirals.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(av, "data-raw/antivirals.sav"), silent = TRUE)
|
||||
try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE)
|
||||
av_lists <- antivirals %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
|
||||
@ -433,7 +433,7 @@ if (changed_md5(intrinsicR)) {
|
||||
write_md5(intrinsicR)
|
||||
try(saveRDS(intrinsicR, "data-raw/intrinsic_resistant.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(intrinsicR, "data-raw/intrinsic_resistant.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(intrinsicR, "data-raw/intrinsic_resistant.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(intrinsicR, "data-raw/intrinsic_resistant.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(intrinsicR, "data-raw/intrinsic_resistant.sav"), silent = TRUE)
|
||||
try(haven::write_dta(intrinsicR, "data-raw/intrinsic_resistant.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(intrinsicR, "data-raw/intrinsic_resistant.xlsx"), silent = TRUE)
|
||||
@ -446,7 +446,7 @@ if (changed_md5(dosage)) {
|
||||
write_md5(dosage)
|
||||
try(saveRDS(dosage, "data-raw/dosage.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(dosage, "data-raw/dosage.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(dosage, "data-raw/dosage.sas"), silent = TRUE)
|
||||
try(haven::write_xpt(dosage, "data-raw/dosage.xpt"), silent = TRUE)
|
||||
try(haven::write_sav(dosage, "data-raw/dosage.sav"), silent = TRUE)
|
||||
try(haven::write_dta(dosage, "data-raw/dosage.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE)
|
||||
|
BIN
data-raw/antibiotics.xpt
Normal file
BIN
data-raw/antibiotics.xpt
Normal file
Binary file not shown.
BIN
data-raw/antivirals.xpt
Normal file
BIN
data-raw/antivirals.xpt
Normal file
Binary file not shown.
BIN
data-raw/clinical_breakpoints.xpt
Normal file
BIN
data-raw/clinical_breakpoints.xpt
Normal file
Binary file not shown.
BIN
data-raw/dosage.xpt
Normal file
BIN
data-raw/dosage.xpt
Normal file
Binary file not shown.
BIN
data-raw/intrinsic_resistant.xpt
Normal file
BIN
data-raw/intrinsic_resistant.xpt
Normal file
Binary file not shown.
BIN
data-raw/microorganisms.xpt
Normal file
BIN
data-raw/microorganisms.xpt
Normal file
Binary file not shown.
@ -96,10 +96,9 @@ expect_true(length(mo_synonyms("Candida albicans")) > 1)
|
||||
expect_inherits(mo_synonyms(c("Candida albicans", "Escherichia coli")), "list")
|
||||
expect_equal(names(mo_info("Escherichia coli")), c(
|
||||
"mo",
|
||||
"kingdom", "phylum", "class", "order",
|
||||
"family", "genus", "species", "subspecies",
|
||||
"kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies",
|
||||
"status", "synonyms", "gramstain", "oxygen_tolerance",
|
||||
"url", "ref", "snomed"
|
||||
"url", "ref", "snomed", "lpsn", "gbif"
|
||||
))
|
||||
expect_inherits(mo_info(c("Escherichia coli", "Staphylococcus aureus")), "list")
|
||||
|
||||
|
@ -50,6 +50,7 @@ download_txt <- function(filename) {
|
||||
feather <- paste0(filename, ".feather")
|
||||
parquet <- paste0(filename, ".parquet")
|
||||
sas <- paste0(filename, ".sas")
|
||||
xpt <- paste0(filename, ".xpt")
|
||||
spss <- paste0(filename, ".sav")
|
||||
stata <- paste0(filename, ".dta")
|
||||
create_txt <- function(filename, type, software, exists) {
|
||||
@ -70,6 +71,7 @@ download_txt <- function(filename) {
|
||||
file.exists(feather),
|
||||
file.exists(parquet),
|
||||
file.exists(sas),
|
||||
file.exists(xpt),
|
||||
file.exists(spss),
|
||||
file.exists(stata)
|
||||
)) {
|
||||
@ -80,7 +82,8 @@ download_txt <- function(filename) {
|
||||
create_txt(excel, "xlsx", "Microsoft Excel workbook", file.exists(excel)),
|
||||
create_txt(feather, "feather", "Apache Feather file", file.exists(feather)),
|
||||
create_txt(parquet, "parquet", "Apache Parquet file", file.exists(parquet)),
|
||||
create_txt(sas, "sas", "SAS data file", file.exists(sas)),
|
||||
create_txt(sas, "sas", "SAS data (SAS) file", file.exists(sas)),
|
||||
create_txt(xpt, "xpt", "SAS transport (XPT) file", file.exists(xpt)),
|
||||
create_txt(spss, "sav", "IBM SPSS Statistics data file", file.exists(spss)),
|
||||
create_txt(stata, "dta", "Stata DTA file", file.exists(stata))
|
||||
)
|
||||
@ -123,7 +126,7 @@ This data set is in R available as `microorganisms`, after you load the `AMR` pa
|
||||
|
||||
`r download_txt("microorganisms")`
|
||||
|
||||
**NOTE: The exported files for SAS, SPSS and Stata contain only the first 50 SNOMED codes per record, as their file size would otherwise exceed 100 MB; the file size limit of GitHub.** Advice? Use R instead.
|
||||
**NOTE: The exported files for SAS, SPSS and Stata contain only the first 50 SNOMED codes per record, as their file size would otherwise exceed 100 MB; the file size limit of GitHub.** Their file structures and compression techniques are very inefficient. Advice? Use R instead. It's free and much better in many ways.
|
||||
|
||||
The tab-separated text file and Microsoft Excel workbook both contain all SNOMED codes as comma separated values.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user