diff --git a/DESCRIPTION b/DESCRIPTION index e032519e..34ae0ab2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR Version: 0.2.0 -Date: 2018-04-23 +Date: 2018-04-30 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/R/clipboard.R b/R/clipboard.R index 03ec6f43..65ca625c 100644 --- a/R/clipboard.R +++ b/R/clipboard.R @@ -13,23 +13,15 @@ #' @importFrom utils read.delim write.table object.size #' @details For \code{clipboard_export()}, the reserved clipboard size for exporting will be set to 125\% of the object size of \code{x}. This way, it is possible to export data with thousands of rows as the only limit will be your systems RAM. #' -#' Example for copying from Excel: #' \if{html}{ +#' Example for copying from Excel: #' \out{
}\figure{Excel_copy.png}\out{
} -#' } -#' \if{latex}{ -#' \out{\begin{left}}\figure{Excel_copy.png}\out{\end{left}} -#' } -#' \cr -#' And pasting in R: \cr \cr -#' \code{> data <- clipboard_import()} \cr -#' \code{> data} \cr -#' \if{html}{ +#' \cr +#' And pasting in R: \cr \cr +#' \code{> data <- clipboard_import()} \cr +#' \code{> data} \cr #' \out{
}\figure{Excel_paste.png}\out{
} #' } -#' \if{latex}{ -#' \out{\begin{left}}\figure{Excel_paste.png}\out{\end{left}} -#' } #' @export #' @return data.frame clipboard_import <- function(sep = '\t', @@ -135,14 +127,14 @@ clipboard_export <- function(x, } is_Windows <- function() { - Sys.info()['sysname'] %like% "Windows" + all(Sys.info()['sysname'] %like% "Windows") } check_xclip <- function() { if (!isTRUE(file.exists(Sys.which("xclip")[1L]))) { - if (Sys.info()['sysname'] %like% "Linux") { + if (all(Sys.info()['sysname'] %like% "Linux")) { stop("Please install Linux package xclip first.") } else { - stop("Please install package xclip first (use `brew install xclip on macOS`).") + stop("Please install package xclip first (use `brew install xclip` on macOS).") } } } diff --git a/man/clipboard.Rd b/man/clipboard.Rd index 347da4f0..09607b58 100644 --- a/man/clipboard.Rd +++ b/man/clipboard.Rd @@ -46,23 +46,15 @@ These are helper functions around \code{\link{read.table}} and \code{\link{write \details{ For \code{clipboard_export()}, the reserved clipboard size for exporting will be set to 125\% of the object size of \code{x}. This way, it is possible to export data with thousands of rows as the only limit will be your systems RAM. - Example for copying from Excel: \if{html}{ + Example for copying from Excel: \out{
}\figure{Excel_copy.png}\out{
} - } - \if{latex}{ - \out{\begin{left}}\figure{Excel_copy.png}\out{\end{left}} - } - \cr - And pasting in R: \cr \cr - \code{> data <- clipboard_import()} \cr - \code{> data} \cr - \if{html}{ + \cr + And pasting in R: \cr \cr + \code{> data <- clipboard_import()} \cr + \code{> data} \cr \out{
}\figure{Excel_paste.png}\out{
} } - \if{latex}{ - \out{\begin{left}}\figure{Excel_paste.png}\out{\end{left}} - } } \keyword{clipboard} \keyword{clipboard_export} diff --git a/tests/testthat/test-atc.R b/tests/testthat/test-atc.R index 2946446e..d309bbb9 100644 --- a/tests/testthat/test-atc.R +++ b/tests/testthat/test-atc.R @@ -29,3 +29,16 @@ test_that("guess_bactid works", { "VISA")), rep("STAAUR", 8)) }) + +test_that("guess_atc works", { + expect_equal(guess_atc(c("J01FA01", + "Erythromycin", + "eryt", + "ERYT", + "ERY", + "Erythrocin", + "Eryzole", + "Pediamycin")), + rep("J01FA01", 8)) + +})