Skip to content

Commit

Permalink
address coding style issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wangben718 committed Sep 11, 2023
1 parent 255daaa commit 4b28d04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions R/as_rtf.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#' Create RTF file output from \code{\link{as_table}} to summarize
#' an object; currently only implemented for \code{\link{gsBinomialExact}}.
#'
#' @param x Object to be display on rtf.
#' @param x Object to be displayed on rtf.
#' @param ... Other parameters that may be specific the object.
#'
#' @return NULL.
#' @return RTF file for summary table.
#'
#' @seealso \code{vignette("binomialSPRTExample")}
#'
Expand All @@ -27,7 +27,7 @@
#' as_table() %>%
#' as_rtf(
#' title = "Power/Type I error and expected sample size for a group sequential design",
#' rtf_path = tempfile(fileext = ".rtf")
#' file = tempfile(fileext = ".rtf")
#' )
#'
#' safety_design <- binomialSPRT(p0 = .04, p1 = .1, alpha = .04, beta = .2, minn = 4, maxn = 75)
Expand All @@ -44,7 +44,7 @@
#' theta_label = "Underlying\nAE rate",
#' prob_decimals = 3,
#' bound_label = c("low rate", "high rate"),
#' rtf_path = tempfile(fileext = ".rtf")
#' file = tempfile(fileext = ".rtf")
#' )
as_rtf <- function(x, ...) UseMethod("as_rtf")

Expand All @@ -60,7 +60,7 @@ as_rtf <- function(x, ...) UseMethod("as_rtf")
#' @param en_decimals Number of decimal places for expected number of
#' observations when bound is crossed or when trial ends without crossing.
#' @param rr_decimals Number of decimal places for response rates.
#' @param rtf_path Output path for the rtf file.
#' @param file Output path for the rtf file.
#'
#' @importFrom r2rtf rtf_title rtf_colheader rtf_body rtf_encode write_rtf
#'
Expand All @@ -76,7 +76,7 @@ as_rtf.gsBinomialExactTable <-
prob_decimals = 2,
en_decimals = 1,
rr_decimals = 0,
rtf_path,
file,
...) {
x[,2] <- sprintf(paste0("%.", prob_decimals,"f"), unlist(x[,2]))
x[,3] <- sprintf(paste0("%.", prob_decimals,"f"), unlist(x[,3]))
Expand All @@ -95,8 +95,8 @@ as_rtf.gsBinomialExactTable <-
) %>%
rtf_body() %>%
rtf_encode() %>%
write_rtf(rtf_path)
write_rtf(file)

message("The RTF output is saved in", normalizePath(rtf_path))
message("The RTF output is saved in", normalizePath(file))

}
12 changes: 6 additions & 6 deletions man/as_rtf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b28d04

Please sign in to comment.