Skip to content

Commit

Permalink
Check-in after adding examples in ae-specific.Rmd and ae_summary.Rmd …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
lm3388 committed Oct 17, 2024
1 parent 0b3a461 commit 8d7a767
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
55 changes: 54 additions & 1 deletion vignettes/ae-specific.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ knitr::opts_chunk$set(

```{r}
library(metalite.ae)
devtools::load_all(".") # load package in development and testing phases, need to be removed in production
```

```{r, include=FALSE}
```

```{r, include=FALSE}
```

## Overview
Expand Down Expand Up @@ -182,6 +191,50 @@ tbl <- outdata |>
head(tbl$tbl)
```

We can use `filter_method` and `filter_criteria` parameters to filter information based on the specified criteria:

- `filter_method`: A character value to specify how to filter rows (by `count` or `percent`).
- `count`: Filter based on participant count.
- `percent`: Filter based on percent incidence.
- `filter_criteria`: A numeric value to display rows where at least one therapy group has:
- a percent incidence or participant count greater than or equal to the specified value.
- If `filter_method` is `percent`, the value should be between 0 and 100.
- If `filter_method` is `count`, the value should be greater than 0.


```{r}
tbl <- outdata |>
extend_ae_specific_events() |>
format_ae_specific(display = c("n", "prop", "events_count", "events_avg"),
filter_method = "percent",
filter_criteria = 6)
head(tbl$tbl)
```
In results above, rows having any one of "prop_x" values are greater than 6 get kept in the output.


We can use `sort_order` and `sort_column` parameters to sort results based on the specified criteria:

- `sort_order` A character value to specify sorting order:
- `alphabetical`: Sort by alphabetical order.
- `count_des`: Sort by count in descending order.
- `count_asc`: Sort by count in ascending order.
- `sort_column A` character value of `group` in `outdata` used to sort a table with.

```{r}
tbl <- outdata |>
extend_ae_specific_events() |>
format_ae_specific(
display = c("n", "prop", "events_count", "events_avg"),
sort_order = c("count_des"),
sort_column = c("Placebo"))
head(tbl$tbl)
```

### Mock data preparation

The `mock` argument facilitates the creation of a mock table with ease.
Expand Down Expand Up @@ -252,4 +305,4 @@ outdata |>

```{r, out.width = "100%", out.height = "400px", echo = FALSE, fig.align = "center"}
knitr::include_graphics("pdf/mock_ae0specific1.pdf")
```
```
8 changes: 8 additions & 0 deletions vignettes/ae-summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ outdata |>
knitr::include_graphics("pdf/ae0summary2.pdf")
```


The empty table can be generated if there is not result to display.

```{r, out.width = "100%", out.height = "400px", echo = FALSE, fig.align = "center"}
knitr::include_graphics("pdf/empty_ae0specific.pdf")
```


The mock table can also be generated.

```{r}
Expand Down
Binary file added vignettes/pdf/empty_ae0specific.pdf
Binary file not shown.

0 comments on commit 8d7a767

Please sign in to comment.