1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00

Fix Latex PDF error

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-04-30 16:24:11 +02:00
parent 970e3ed7f1
commit 8fe70d5652
4 changed files with 27 additions and 30 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 0.2.0 Version: 0.2.0
Date: 2018-04-23 Date: 2018-04-30
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person( person(

View File

@ -13,23 +13,15 @@
#' @importFrom utils read.delim write.table object.size #' @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. #' @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}{ #' \if{html}{
#' Example for copying from Excel:
#' \out{<div style="text-align: left">}\figure{Excel_copy.png}\out{</div>} #' \out{<div style="text-align: left">}\figure{Excel_copy.png}\out{</div>}
#' } #' \cr
#' \if{latex}{ #' And pasting in R: \cr \cr
#' \out{\begin{left}}\figure{Excel_copy.png}\out{\end{left}} #' \code{> data <- clipboard_import()} \cr
#' } #' \code{> data} \cr
#' \cr
#' And pasting in R: \cr \cr
#' \code{> data <- clipboard_import()} \cr
#' \code{> data} \cr
#' \if{html}{
#' \out{<div style="text-align: left">}\figure{Excel_paste.png}\out{</div>} #' \out{<div style="text-align: left">}\figure{Excel_paste.png}\out{</div>}
#' } #' }
#' \if{latex}{
#' \out{\begin{left}}\figure{Excel_paste.png}\out{\end{left}}
#' }
#' @export #' @export
#' @return data.frame #' @return data.frame
clipboard_import <- function(sep = '\t', clipboard_import <- function(sep = '\t',
@ -135,14 +127,14 @@ clipboard_export <- function(x,
} }
is_Windows <- function() { is_Windows <- function() {
Sys.info()['sysname'] %like% "Windows" all(Sys.info()['sysname'] %like% "Windows")
} }
check_xclip <- function() { check_xclip <- function() {
if (!isTRUE(file.exists(Sys.which("xclip")[1L]))) { 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.") stop("Please install Linux package xclip first.")
} else { } 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).")
} }
} }
} }

View File

@ -46,23 +46,15 @@ These are helper functions around \code{\link{read.table}} and \code{\link{write
\details{ \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. 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}{ \if{html}{
Example for copying from Excel:
\out{<div style="text-align: left">}\figure{Excel_copy.png}\out{</div>} \out{<div style="text-align: left">}\figure{Excel_copy.png}\out{</div>}
} \cr
\if{latex}{ And pasting in R: \cr \cr
\out{\begin{left}}\figure{Excel_copy.png}\out{\end{left}} \code{> data <- clipboard_import()} \cr
} \code{> data} \cr
\cr
And pasting in R: \cr \cr
\code{> data <- clipboard_import()} \cr
\code{> data} \cr
\if{html}{
\out{<div style="text-align: left">}\figure{Excel_paste.png}\out{</div>} \out{<div style="text-align: left">}\figure{Excel_paste.png}\out{</div>}
} }
\if{latex}{
\out{\begin{left}}\figure{Excel_paste.png}\out{\end{left}}
}
} }
\keyword{clipboard} \keyword{clipboard}
\keyword{clipboard_export} \keyword{clipboard_export}

View File

@ -29,3 +29,16 @@ test_that("guess_bactid works", {
"VISA")), "VISA")),
rep("STAAUR", 8)) rep("STAAUR", 8))
}) })
test_that("guess_atc works", {
expect_equal(guess_atc(c("J01FA01",
"Erythromycin",
"eryt",
"ERYT",
"ERY",
"Erythrocin",
"Eryzole",
"Pediamycin")),
rep("J01FA01", 8))
})