Skip to content

Commit a279ec0

Browse files
committed
fix: minor fix in names
1 parent 157c194 commit a279ec0

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

R/tm_rmarkdown.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#' }
6565
#'
6666
#' @examples
67-
#' static_decorator <- teal_transform_module(
67+
#' nrow_transform <- teal_transform_module(
6868
#' label = "N Rows selector",
6969
#' ui = function(id) {
7070
#' ns <- NS(id)
@@ -91,7 +91,7 @@
9191
#' label = "RMarkdown Module",
9292
#' rmd_file = "test.Rmd",
9393
#' allow_download = FALSE,
94-
#' decorators = list(static_decorator)
94+
#' extra_transform = list(nrow_transform)
9595
#' )
9696
#' )
9797
#' ) |> shiny::runApp()
@@ -165,7 +165,7 @@ ui_rmarkdown <- function(id, rmd_file, allow_download, extra_transform, ...) {
165165
}
166166

167167
# Server function for the rmarkdown module
168-
srv_rmarkdown <- function(id, data, rmd_file, allow_download, decorators) {
168+
srv_rmarkdown <- function(id, data, rmd_file, allow_download, extra_transform) {
169169
checkmate::assert_class(data, "reactive")
170170
checkmate::assert_class(isolate(data()), "teal_data")
171171
moduleServer(id, function(input, output, session) {

inst/sample_files/test.Rmd

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "Test R Markdown"
3+
output: html_document
4+
params:
5+
CO2: NULL
6+
yada: 42
7+
n_rows: NULL
8+
---
9+
10+
This is an example of an R markdown file with an inline r execution that gives the current date: `r Sys.Date()`
11+
12+
Code chunk that performs a simple calculation (`1+1`)
13+
14+
```{r}
15+
1+1
16+
```
17+
18+
Code chunk that shows the structure of the params object
19+
20+
```{r}
21+
lapply(params, class)
22+
```
23+
24+
Code chunk that shows the summary of the first `n_rows` of the `CO2` dataset if it is provided
25+
26+
```{r}
27+
summary(head(params$CO2, n = params$n_rows))
28+
```
29+
30+
Code chunk that plots the first `n_rows` of the `CO2` dataset if it is provided
31+
32+
```{r, eval = !is.null(params$CO2)}
33+
plot(head(params$CO2, n = params$n_rows))
34+
```

0 commit comments

Comments
 (0)