see news.md

This commit is contained in:
AG Damsbo 2023-01-16 09:22:21 +01:00
parent 7c8b898eed
commit 25859ea7c0
7 changed files with 11 additions and 96 deletions

3
CRAN-SUBMISSION Normal file
View File

@ -0,0 +1,3 @@
Version: 23.1.5
Date: 2023-01-12 13:45:40 UTC
SHA: 7c8b898eed02d293103c10ab59e40df4f2dd1296

View File

@ -1,6 +1,6 @@
Package: stRoke Package: stRoke
Title: Clinical Stroke Research Toolbox Title: Clinical Stroke Research Toolbox
Version: 23.1.5 Version: 23.1.6
Authors@R: Authors@R:
person("Andreas Gammelgaard", "Damsbo", , "agdamsbo@clin.au.dk", role = c("aut", "cre"), person("Andreas Gammelgaard", "Damsbo", , "agdamsbo@clin.au.dk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7559-1154")) comment = c(ORCID = "0000-0002-7559-1154"))
@ -30,9 +30,7 @@ Imports:
cli, cli,
dplyr, dplyr,
ggplot2, ggplot2,
gt,
gtsummary, gtsummary,
magick,
MASS, MASS,
rankinPlot, rankinPlot,
REDCapR, REDCapR,

View File

@ -7,7 +7,6 @@ export(cpr_dob)
export(cpr_female) export(cpr_female)
export(files_filter) export(files_filter)
export(generic_stroke) export(generic_stroke)
export(gt_plot)
export(index_plot) export(index_plot)
export(label_select) export(label_select)
export(quantile_cut) export(quantile_cut)
@ -18,12 +17,8 @@ import(utils)
importFrom(MASS,polr) importFrom(MASS,polr)
importFrom(dplyr,mutate) importFrom(dplyr,mutate)
importFrom(dplyr,select) importFrom(dplyr,select)
importFrom(gt,gtsave)
importFrom(gtsummary,add_overall) importFrom(gtsummary,add_overall)
importFrom(gtsummary,as_gt)
importFrom(gtsummary,tbl_summary) importFrom(gtsummary,tbl_summary)
importFrom(magick,image_ggplot)
importFrom(magick,image_read)
importFrom(rankinPlot,grottaBar) importFrom(rankinPlot,grottaBar)
importFrom(stats,as.formula) importFrom(stats,as.formula)
importFrom(stats,binomial) importFrom(stats,binomial)

View File

@ -1,4 +1,10 @@
# stRoke 0.23.1.5 # stRoke 23.1.6
## Notes:
* 23.1.5 failed on CRAN due to gt_plot(). This function has been dropped. Find it as as_ggplot() elsewhere.
# stRoke 23.1.5
## RELEASE ON CRAN ## RELEASE ON CRAN

View File

@ -1,35 +0,0 @@
#' Plot a gt or gtsummary table as ggplot object
#'
#' Relying on `library(magick)` and `library(webshot2)`
#' @param x A 'gt' or 'gtsummary' table
#' @param ... Additional arguments to be passed to gt::gtsave
#'
#' @return gg/ggplot element
#' @export
#'
#' @references
#' Please refer
#' to [MSKCC-Epi-Bio/bstfun](https://github.com/MSKCC-Epi-Bio/bstfun)
#'
#' @importFrom magick image_read image_ggplot
#' @importFrom gtsummary as_gt tbl_summary
#' @importFrom gt gtsave
#'
#' @examples
#' #gt_plot(mtcars |> gtsummary::tbl_summary())
gt_plot <- function (x, ...)
{
if (!inherits(x, c("gt_tbl", "gtsummary")))
stop("`x=` must be a 'gt' or 'gtsummary' table", call. = FALSE)
if (inherits(x, "gtsummary"))
x <- gtsummary::as_gt(x)
path_gt_table_image <- tempfile(fileext = ".png")
gt_table_image <-
gt::gtsave(x, filename = path_gt_table_image, ...)
magick::image_read(path_gt_table_image) |>
magick::image_ggplot(interpolate = TRUE)
}
#'

View File

@ -1,26 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gt_plot.R
\name{gt_plot}
\alias{gt_plot}
\title{Plot a gt or gtsummary table as ggplot object}
\usage{
gt_plot(x, ...)
}
\arguments{
\item{x}{A 'gt' or 'gtsummary' table}
\item{...}{Additional arguments to be passed to gt::gtsave}
}
\value{
gg/ggplot element
}
\description{
Relying on \code{library(magick)} and \code{library(webshot2)}
}
\examples{
#gt_plot(mtcars |> gtsummary::tbl_summary())
}
\references{
Please refer
to \href{https://github.com/MSKCC-Epi-Bio/bstfun}{MSKCC-Epi-Bio/bstfun}
}

View File

@ -116,32 +116,6 @@ generic_stroke(stRoke::talos,
variables = c("hypertension", "diabetes", "civil")) variables = c("hypertension", "diabetes", "civil"))
``` ```
You can make a combined plot of the ppplot elements with `library(patchwork)` and use `gt_plot()` to plot gt elements.
```{r gt_plot-example, eval=FALSE}
require(patchwork)
data(talos)
talos[, "alone"] <-
factor(ifelse(talos[, "civil"] == "alone", "yes", "no"))
talos[, "placebo"] <-
factor(ifelse(talos[, "rtreat"] == "Placebo", "yes", "no"))
l <-
generic_stroke(
df = talos,
group = "placebo",
score = "mrs_6",
variables = c("hypertension", "diabetes", "alone")
)
# l[[1]] |> gt_plot()
l[[2]] + l[[3]]
```
### index_plot() ### index_plot()
Used for plotting scores from a multi dimensional patient test. Used for plotting scores from a multi dimensional patient test.