diff --git a/NAMESPACE b/NAMESPACE index 6f66f3bf..de525c23 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -50,12 +50,9 @@ export(save_output.dlisting) export(save_outputs) export(slides_preview) export(t_ae_pt_diff_slide) -export(t_ae_pt_diff_slide_to_df) export(t_ae_pt_slide) export(t_ae_pt_soc_diff_slide) -export(t_ae_pt_soc_diff_slide_to_df) export(t_ae_pt_soc_slide) -export(t_ae_pt_soc_slide_to_df) export(t_ae_slide) export(t_ae_summ_slide) export(t_aesi_slide) diff --git a/R/drtable_chg_name.R b/R/drtable.R similarity index 100% rename from R/drtable_chg_name.R rename to R/drtable.R diff --git a/R/t_ae_pt_diff_slide.R b/R/t_ae_pt_diff_slide.R index 54cc7ecb..695d43a5 100755 --- a/R/t_ae_pt_diff_slide.R +++ b/R/t_ae_pt_diff_slide.R @@ -31,7 +31,6 @@ t_ae_pt_diff_slide <- function(adsl, adae, arm = "TRT01A", cutoff = NA, if (!all(dim(result@rowspans) == c(0, 0))) { if (is.null(side_by_side)) { - attr(result, "df") <- t_ae_pt_diff_slide_to_df(result) # adding "N" attribute arm <- col_paths(result)[[1]][1] diff --git a/R/t_ae_pt_diff_slide_to_df.R b/R/t_ae_pt_diff_slide_to_df.R deleted file mode 100755 index 2541ef5d..00000000 --- a/R/t_ae_pt_diff_slide_to_df.R +++ /dev/null @@ -1,50 +0,0 @@ -#' autoslider: t_ae_pt_diff_slide to dataframe -#' -#' @param t_ae_pt_diff_slide an output from the autoslider function `t_ae_pt_diff_slide` -#' See \link[autoslideR]{t_ae_pt_diff_slide} -#' -#' @return dataframe object -#' -#' @export -#' -#' @examples -#' library(dplyr) -#' adsl <- eg_adsl %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae <- eg_adae %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae$ATOXGR <- adae$AETOXGR -#' my_tbl <- t_ae_pt_diff_slide(adsl, adae, "TRT01A", 2) -#' -#' t_ae_pt_diff_slide_to_df(my_tbl) -t_ae_pt_diff_slide_to_df <- function(t_ae_pt_diff_slide) { - # check that input is a s34 object - assertthat::assert_that(isS4(t_ae_pt_diff_slide), - msg = "Input not of the correct format" - ) - - # define treatment arm variable - arm <- col_paths(t_ae_pt_diff_slide)[[1]][1] - - t_ae_pt_diff_tbls <- t_ae_pt_diff_slide@children - - t_ae_pt_diff_r <- lapply(names(t_ae_pt_diff_tbls), function(x) { - arow <- t_ae_pt_diff_tbls[[x]]@leaf_value - lapply(names(arow), function(y) { - data.frame( - ARM = rep(y, 2), - LEVEL1_FORMAT = rep(x, 2), - CONTENT = c("count", "percent"), - NUMVALUE = as.numeric(arow[[y]] %>% unlist()) * c(1, 100) - ) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) %>% - `colnames<-`(c(paste(arm), "LEVEL1_FORMAT", "CONTENT", "NUMVALUE")) %>% - arrange(get(arm), LEVEL1_FORMAT, CONTENT) - - - - return(t_ae_pt_diff_r) -} diff --git a/R/t_ae_pt_soc_diff_slide.R b/R/t_ae_pt_soc_diff_slide.R index e561e71d..fe02fe90 100755 --- a/R/t_ae_pt_soc_diff_slide.R +++ b/R/t_ae_pt_soc_diff_slide.R @@ -32,7 +32,6 @@ t_ae_pt_soc_diff_slide <- function(adsl, adae, arm = "TRT01A", cutoff = NA, result@main_title <- "Adverse Events with Difference" if (is.null(side_by_side)) { - attr(result, "df") <- t_ae_pt_soc_diff_slide_to_df(result) # adding "N" attribute arm <- col_paths(result)[[1]][1] diff --git a/R/t_ae_pt_soc_diff_slide_to_df.R b/R/t_ae_pt_soc_diff_slide_to_df.R deleted file mode 100755 index fd1bf88c..00000000 --- a/R/t_ae_pt_soc_diff_slide_to_df.R +++ /dev/null @@ -1,59 +0,0 @@ -#' autoslider: t_ae_pt_soc_diff_slide to dataframe -#' @details -#' Takes the output from t_ae_pt_soc_diff_slide and converts it to a dataframe of a similar -#' format to SAS result tables. -#' @param t_ae_pt_soc_diff_slide output from function `t_ae_pt_soc_diff_slide`. See -#' \link[autoslideR]{t_ae_pt_soc_diff_slide} -#' @return dataframe object -#' @export -#' -#' @examples -#' library(dplyr) -#' adsl <- eg_adsl %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae <- eg_adae %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae$ATOXGR <- adae$AETOXGR -#' my_tbl <- t_ae_pt_soc_diff_slide(adsl, adae, "TRT01A", 2) -#' -#' t_ae_pt_soc_diff_slide_to_df(my_tbl) -# main function -t_ae_pt_soc_diff_slide_to_df <- function(t_ae_pt_soc_diff_slide) { - # make sure input is in correct format - assert_that(isS4(t_ae_pt_soc_diff_slide), msg = "Is not t_ae_pt_soc_diff_slide output") - - # pulling out the treatment assignment variable - arm <- col_paths(t_ae_pt_soc_diff_slide)[[1]][1] - - t_ae_pt_soc_diff_tbls <- t_ae_pt_soc_diff_slide@children # 1 - - t_ae_pt_soc_diff_r <- lapply(names(t_ae_pt_soc_diff_tbls), function(x) { - t_ae_pt_soc_diff_tbls_1 <- t_ae_pt_soc_diff_tbls[[x]]@children # 2 - - lapply(names(t_ae_pt_soc_diff_tbls_1), function(y) { - t_ae_pt_soc_diff_tbls_2 <- t_ae_pt_soc_diff_tbls_1[[y]]@children # 3 - - lapply(names(t_ae_pt_soc_diff_tbls_2), function(z) { - arow <- t_ae_pt_soc_diff_tbls_2[[z]]@leaf_value # 4 - - lapply(names(arow), function(a) { - data.frame( - ARM = rep(a, 2), - AEBODSYS = rep(x, 2), - LEVEL1_FORMAT = rep(z, 2), - CONTENT = c("count", "percent"), - NUMVALUE = as.numeric(arow[[a]] %>% unlist()) * c(1, 100) - ) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) %>% - `colnames<-`(c(sym(arm), "AEBODSYS", "LEVEL1_FORMAT", "CONTENT", "NUMVALUE")) %>% - dplyr::arrange(get(arm), AEBODSYS, LEVEL1_FORMAT, CONTENT) - - return(t_ae_pt_soc_diff_r) -} diff --git a/R/t_ae_pt_soc_slide.R b/R/t_ae_pt_soc_slide.R index ea281d69..d45cfb47 100755 --- a/R/t_ae_pt_soc_slide.R +++ b/R/t_ae_pt_soc_slide.R @@ -42,7 +42,6 @@ t_ae_pt_soc_slide <- function(adsl, adae, arm, cutoff = NA, result@main_title <- "Adverse Events table" if (is.null(side_by_side)) { - attr(result, "df") <- t_ae_pt_soc_slide_to_df(result) # adding "N" attribute arm <- col_paths(result)[[1]][1] diff --git a/R/t_ae_pt_soc_slide_to_df.R b/R/t_ae_pt_soc_slide_to_df.R deleted file mode 100755 index b0009f82..00000000 --- a/R/t_ae_pt_soc_slide_to_df.R +++ /dev/null @@ -1,60 +0,0 @@ -#' autoslider: t_ae_pt_soc_slide to dataframe -#' @details -#' Takes the output from t_ae_pt_soc_slide and converts it to a dataframe of a similar -#' format to SAS result tables. -#' @param t_ae_pt_soc_slide output from function `t_ae_pt_soc_slide`. See -#' \link[autoslideR]{t_ae_pt_soc_slide} -#' @return dataframe object -#' @export -#' -#' @examples -#' library(dplyr) -#' adsl <- eg_adsl %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae <- eg_adae %>% -#' mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -#' adae$ATOXGR <- adae$AETOXGR -#' my_tbl <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 2) -#' -#' t_ae_pt_soc_slide_to_df(my_tbl) -# main function -t_ae_pt_soc_slide_to_df <- function(t_ae_pt_soc_slide) { - # make sure input is in correct format - assert_that(isS4(t_ae_pt_soc_slide), msg = "Is not t_ae_pt_soc_slide output") - - # pulling out the treatment assignment variable - arm <- col_paths(t_ae_pt_soc_slide)[[1]][1] - - t_ae_pt_soc_tbls <- t_ae_pt_soc_slide@children # 1 - - t_ae_pt_soc_r <- - lapply(names(t_ae_pt_soc_tbls), function(x) { - t_ae_pt_soc_tbls_1 <- t_ae_pt_soc_tbls[[x]]@children # 2 - - lapply(names(t_ae_pt_soc_tbls_1), function(y) { - t_ae_pt_soc_tbls_2 <- t_ae_pt_soc_tbls_1[[y]]@children # 3 - - lapply(names(t_ae_pt_soc_tbls_2), function(z) { - arow <- t_ae_pt_soc_tbls_2[[z]]@leaf_value # 4 - - lapply(names(arow), function(a) { - data.frame( - ARM = rep(a, 2), - AEBODSYS = rep(x, 2), - LEVEL1_FORMAT = rep(z, 2), - CONTENT = c("count", "percent"), - NUMVALUE = as.numeric(arow[[a]] %>% unlist()) * c(1, 100) - ) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) - }) %>% - do.call("rbind", .) %>% - `colnames<-`(c(sym(arm), "AEBODSYS", "LEVEL1_FORMAT", "CONTENT", "NUMVALUE")) %>% - dplyr::arrange(get(arm), AEBODSYS, LEVEL1_FORMAT, CONTENT) - - return(t_ae_pt_soc_r) -} diff --git a/man/t_ae_pt_diff_slide_to_df.Rd b/man/t_ae_pt_diff_slide_to_df.Rd deleted file mode 100644 index 89f3d458..00000000 --- a/man/t_ae_pt_diff_slide_to_df.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/t_ae_pt_diff_slide_to_df.R -\name{t_ae_pt_diff_slide_to_df} -\alias{t_ae_pt_diff_slide_to_df} -\title{autoslider: t_ae_pt_diff_slide to dataframe} -\usage{ -t_ae_pt_diff_slide_to_df(t_ae_pt_diff_slide) -} -\arguments{ -\item{t_ae_pt_diff_slide}{an output from the autoslider function `t_ae_pt_diff_slide` -See \link[autoslideR]{t_ae_pt_diff_slide}} -} -\value{ -dataframe object -} -\description{ -autoslider: t_ae_pt_diff_slide to dataframe -} -\examples{ -library(dplyr) -adsl <- eg_adsl \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae <- eg_adae \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae$ATOXGR <- adae$AETOXGR -my_tbl <- t_ae_pt_diff_slide(adsl, adae, "TRT01A", 2) - -t_ae_pt_diff_slide_to_df(my_tbl) -} diff --git a/man/t_ae_pt_soc_diff_slide_to_df.Rd b/man/t_ae_pt_soc_diff_slide_to_df.Rd deleted file mode 100644 index 04f2715b..00000000 --- a/man/t_ae_pt_soc_diff_slide_to_df.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/t_ae_pt_soc_diff_slide_to_df.R -\name{t_ae_pt_soc_diff_slide_to_df} -\alias{t_ae_pt_soc_diff_slide_to_df} -\title{autoslider: t_ae_pt_soc_diff_slide to dataframe} -\usage{ -t_ae_pt_soc_diff_slide_to_df(t_ae_pt_soc_diff_slide) -} -\arguments{ -\item{t_ae_pt_soc_diff_slide}{output from function `t_ae_pt_soc_diff_slide`. See -\link[autoslideR]{t_ae_pt_soc_diff_slide}} -} -\value{ -dataframe object -} -\description{ -autoslider: t_ae_pt_soc_diff_slide to dataframe -} -\details{ -Takes the output from t_ae_pt_soc_diff_slide and converts it to a dataframe of a similar -format to SAS result tables. -} -\examples{ -library(dplyr) -adsl <- eg_adsl \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae <- eg_adae \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae$ATOXGR <- adae$AETOXGR -my_tbl <- t_ae_pt_soc_diff_slide(adsl, adae, "TRT01A", 2) - -t_ae_pt_soc_diff_slide_to_df(my_tbl) -} diff --git a/man/t_ae_pt_soc_slide_to_df.Rd b/man/t_ae_pt_soc_slide_to_df.Rd deleted file mode 100644 index 6ed648e5..00000000 --- a/man/t_ae_pt_soc_slide_to_df.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/t_ae_pt_soc_slide_to_df.R -\name{t_ae_pt_soc_slide_to_df} -\alias{t_ae_pt_soc_slide_to_df} -\title{autoslider: t_ae_pt_soc_slide to dataframe} -\usage{ -t_ae_pt_soc_slide_to_df(t_ae_pt_soc_slide) -} -\arguments{ -\item{t_ae_pt_soc_slide}{output from function `t_ae_pt_soc_slide`. See -\link[autoslideR]{t_ae_pt_soc_slide}} -} -\value{ -dataframe object -} -\description{ -autoslider: t_ae_pt_soc_slide to dataframe -} -\details{ -Takes the output from t_ae_pt_soc_slide and converts it to a dataframe of a similar -format to SAS result tables. -} -\examples{ -library(dplyr) -adsl <- eg_adsl \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae <- eg_adae \%>\% - mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) -adae$ATOXGR <- adae$AETOXGR -my_tbl <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 2) - -t_ae_pt_soc_slide_to_df(my_tbl) -}