Skip to content

Commit 700630a

Browse files
authored
206 fix failed pipeline (#207)
Fixes #206
1 parent 6d19f11 commit 700630a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Suggests:
4040
testthat (>= 3.1.5),
4141
withr (>= 2.0.0)
4242
VignetteBuilder:
43-
knitr
43+
knitr,
44+
rmarkdown
4445
RdMacros:
4546
lifecycle
4647
Config/Needs/verdepcheck: mllg/checkmate, r-lib/lifecycle, r-lib/rlang,

vignettes/qenv.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ print(empty_qenv)
2626

2727
### `qenv` basic usage
2828

29-
The `eval_code()` function executes code within a `qenv` environment, yielding a new `qenv` object as the output.
29+
The `eval_code()` function executes code within a `qenv` environment, yielding a new `qenv` object as the output.
3030

3131
```{r}
32-
library(magrittr)
33-
3432
# evaluate code in qenv
3533
my_qenv <- eval_code(empty_qenv, "x <- 2")
3634
print(my_qenv)
3735
get_env(my_qenv)
3836
3937
40-
q1 <- eval_code(my_qenv, "y <- x * 2") %>% eval_code("z <- y * 2")
38+
q1 <- eval_code(my_qenv, "y <- x * 2")
39+
q1 <- eval_code(q1, "z <- y * 2")
4140
4241
# my_qenv still contains only x
4342
print(my_qenv)
@@ -50,7 +49,8 @@ ls(get_env(q1))
5049

5150
The same result can be achieved with the `within` method for the `qenv` class.
5251
```{r}
53-
q2 <- within(my_qenv, y <- x * 2) %>% within(z <- y * 2)
52+
q2 <- within(my_qenv, y <- x * 2)
53+
q2 <- within(q2, z <- y * 2)
5454
print(q2)
5555
```
5656

@@ -66,7 +66,7 @@ cat(get_code(q2))
6666
```
6767

6868
### Substitutions
69-
In some cases, one may want to substitute some elements of the code before evaluation.
69+
In some cases, one may want to substitute some elements of the code before evaluation.
7070
Consider a case when a subset of `iris` is defined by an input value.
7171
```{r}
7272
q <- qenv()
@@ -147,11 +147,11 @@ These functions can be seamlessly integrated into `shiny` applications to produc
147147

148148
When employing a `qenv` to evaluate code, should an error occur, an object of type `qenv.error` is generated. This object can be utilized wherever a `qenv` object is used, alleviating the need for code alterations to handle these errors. Select the `error_option` in the example below to witness `qenv` error handling in action.
149149

150-
```{r}
150+
```{r, eval=requireNamespace("shiny")}
151151
library(shiny)
152-
library(magrittr)
153152
# create an initial qenv with the data in
154-
data_q <- qenv() %>% eval_code("iris_data <- iris")
153+
data_q <- qenv()
154+
data_q <- eval_code(data_q, "iris_data <- iris")
155155
156156
ui <- fluidPage(
157157
radioButtons(

0 commit comments

Comments
 (0)