mirror of
https://github.com/agdamsbo/stRoke.git
synced 2024-11-21 20:40:22 +01:00
see news.md
This commit is contained in:
parent
7c8b898eed
commit
25859ea7c0
3
CRAN-SUBMISSION
Normal file
3
CRAN-SUBMISSION
Normal file
@ -0,0 +1,3 @@
|
||||
Version: 23.1.5
|
||||
Date: 2023-01-12 13:45:40 UTC
|
||||
SHA: 7c8b898eed02d293103c10ab59e40df4f2dd1296
|
@ -1,6 +1,6 @@
|
||||
Package: stRoke
|
||||
Title: Clinical Stroke Research Toolbox
|
||||
Version: 23.1.5
|
||||
Version: 23.1.6
|
||||
Authors@R:
|
||||
person("Andreas Gammelgaard", "Damsbo", , "agdamsbo@clin.au.dk", role = c("aut", "cre"),
|
||||
comment = c(ORCID = "0000-0002-7559-1154"))
|
||||
@ -30,9 +30,7 @@ Imports:
|
||||
cli,
|
||||
dplyr,
|
||||
ggplot2,
|
||||
gt,
|
||||
gtsummary,
|
||||
magick,
|
||||
MASS,
|
||||
rankinPlot,
|
||||
REDCapR,
|
||||
|
@ -7,7 +7,6 @@ export(cpr_dob)
|
||||
export(cpr_female)
|
||||
export(files_filter)
|
||||
export(generic_stroke)
|
||||
export(gt_plot)
|
||||
export(index_plot)
|
||||
export(label_select)
|
||||
export(quantile_cut)
|
||||
@ -18,12 +17,8 @@ import(utils)
|
||||
importFrom(MASS,polr)
|
||||
importFrom(dplyr,mutate)
|
||||
importFrom(dplyr,select)
|
||||
importFrom(gt,gtsave)
|
||||
importFrom(gtsummary,add_overall)
|
||||
importFrom(gtsummary,as_gt)
|
||||
importFrom(gtsummary,tbl_summary)
|
||||
importFrom(magick,image_ggplot)
|
||||
importFrom(magick,image_read)
|
||||
importFrom(rankinPlot,grottaBar)
|
||||
importFrom(stats,as.formula)
|
||||
importFrom(stats,binomial)
|
||||
|
8
NEWS.md
8
NEWS.md
@ -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
|
||||
|
||||
|
35
R/gt_plot.R
35
R/gt_plot.R
@ -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)
|
||||
}
|
||||
#'
|
@ -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}
|
||||
}
|
@ -116,32 +116,6 @@ generic_stroke(stRoke::talos,
|
||||
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()
|
||||
|
||||
Used for plotting scores from a multi dimensional patient test.
|
||||
|
Loading…
Reference in New Issue
Block a user