-
-
Notifications
You must be signed in to change notification settings - Fork 8
Use evaluate #258
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
base: main
Are you sure you want to change the base?
Use evaluate #258
Conversation
Code Coverage Summary
Diff against main
Results for commit: d17b8df Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 14 suites 5s ⏱️ Results for commit d17b8df. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit b53f9e1 ♻️ This comment has been updated with latest results. |
- mask environment for qenv - remove semicolon from the code
targets: #258
@gogonzo This might be a better solution that keeps the override under `evaluate()`, while avoiding changing who the `parent.env` is. That is, we don't need to check the "`grand.parent.env()`"
Co-authored-by: André Veríssimo <[email protected]> Signed-off-by: Dawid Kałędkowski <[email protected]>
…d function (#261) ### Changes description - Remove intermediate plots by default - Avoids deprecated function in testthat 3rd edition - Adds some tests - Q: Does the S4 test make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Fantastic new feature to qenv()
!
Left one last comment about adding the information to vignettes
@@ -1,11 +1,16 @@ | |||
# teal.code 0.6.1.9003 | |||
|
|||
### Enhancements | |||
|
|||
* Introduced `get_outputs` function to fetch objects which have been printed or plotted in the `qenv` code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a small section on the vignette as well? in addition to "### Warnings and messages in qenv
objects"
diff --git a/vignettes/qenv.Rmd b/vignettes/qenv.Rmd
index 4859e32c..302b6846 100644
--- a/vignettes/qenv.Rmd
+++ b/vignettes/qenv.Rmd
@@ -126,7 +126,7 @@ The feasibility of joining `qenv` objects hinges on the contents of the environm
### Warnings and messages in `qenv` objects
-In cases where warnings or messages arise while evaluating code within a `qenv` environment, these are captured and stored within the `qenv` object. Access these messages and warnings using below
+In cases where warnings or messages arise while evaluating code within a `qenv` environment, these are captured and stored within the `qenv` object. Access these messages and warnings using `get_messages()` and `get_warnings()` functions as shown below.
```{r}
q_message <- eval_code(qenv(), quote(message("this is a message")))
@@ -138,6 +138,15 @@ get_warnings(q_warning)
If any of above returns `NULL`m then no warnings nor messages were present.
+### Outputs in `qenv` objects
+
+When evaluating code in a `qenv`, the outputs are captured and stored in a list. This includes printed objects, plots, warnings, and messages. You can retrieve these outputs using the `get_outputs()` function.
+
+```{r}
+q_output <- eval_code(qenv(), quote(plot(1:10)))
+get_outputs(q_output)
+```
+
## Utilizing `qenv` inside `shiny` applications
These functions can be seamlessly integrated into `shiny` applications to produce reproducible outputs. In the example below, the `rcode` section showcases the code employed for generating the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've included some info about get_outputs()
. Please have a look once again before I merge
Followup to insightsengineering/teal.code#258 - eval_code adds `attr(code, "outputs")` to the `teal_card` but skips the warnings and messages (conditions).
eval_code
caches now outputs of the code in theattr(<code line>, "outputs")
. See the tests ofget_outputs
to see how it works.