-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add mechanism to define variables created in WebAssembly blocks also at build time #42
Comments
This gets into an exceedingly gray and murky area quickly. One solution that you might want to consider is creating a new custom wasm cell after the original cells are evaluated. You can see a demo of it with |
Another interesting approach @topepo and I converged on in the meantime is the following: using the ```{webr}
#| label: some-label
foo <- data.frame(x=c(2,4,6))
```
```{r}
#| include: false
#| ref-label: some-label
```
Some inline text, computed at build-time: `nrow(foo)=` `r nrow(foo)`.
```{webr}
summary(foo)
plot(foo)
``` Of course, since we're not using the OJS features here the inline R computations such as I think something that would help here in future is for Quarto Live to support inline webR blocks, such as
|
Another option would be a short code relying on knitr, c.f. https://github.com/insightsengineering/tlg-catalog/blob/main/book/_utils/webr.qmd Motivation: https://pharmaverse.github.io/blog/posts/2024-05-08_tlg_catalog_webr/tlg_catalog_webr.html On the inline part, I think that'll have to come when this gets promoted into Quarto. The attempt the worked the best was a shortcode as far as I can recall. |
@topepo
For example, if we have the block:
with code to be run under WebAssembly at run time, it could be useful for this code to optionally also run at build time so that the results can be accessed in later standard R blocks,
This needs to be thought about, because changing the WebAssembly block contents and re-running won't be reflected in the build time
{r}
blocks.Instead, an OJS block might be a better fit for reactivity, e.g.
The text was updated successfully, but these errors were encountered: