Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme tableone display #376

Merged
merged 4 commits into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ adtte %>%

The `tableone()` function presents summary statistics in a table format.

```{r table, warning=FALSE, message = FALSE}
```{r tableone, warning=FALSE, message = FALSE}
## table by treatment - without overall and render with GT
adtte %>%
tableone <-
adtte %>%
dplyr::select(AGE, SEX, TRTA) %>%
visR::tableone(
strata = "TRTA",
Expand All @@ -123,6 +124,20 @@ adtte %>%
)
```

```{r tableone_print, include = FALSE}
# Had to manually save images in temp file, not sure if better way.
gt::gtsave(tableone, file = file.path(tempdir(), "temp.png"))
```

```{r out.width = "90%", echo = FALSE}
# Have to do this workaround since the README needs markdown format for GitHub page but a different format for the website.
if (identical(Sys.getenv("IN_PKGDOWN"), "true")) {
table1 # display true html table
} else {
# show saved image
knitr::include_graphics("man/figures/README-tableone_print-1.png")
}
```

## Cite visR

Expand Down
Loading