Skip to content
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

Possible for an R or Python value to act as an input to a later cell? #35

Open
coatless opened this issue Jul 31, 2024 · 3 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@coatless
Copy link
Collaborator

Glancing at the Parameterised Exercises, the random value being generated uses OJS. Is there a way to generate an R or Python value and pass it forward?

I remember we briefly chatted about the syntax for accessing variables being ${}; but, I can't remember if the inline value had to be initialized with ojs instead of an R/Python engine.

https://quarto-live-dev.netlify.app/interactive/dynamic#parameterised-exercises

@georgestagg
Copy link
Member

Yes, you should be able to define in a block and then input it later. Similar to https://quarto-live-dev.netlify.app/interactive/hybrid#passing-data-between-engines but with the same engine.

Once define’d, you should be able to use the variable in the same way as ones defined in OJS. The only issue I think might happen is that everything is a vector in R so you might need to do things like ${var[0]} for the moment.

@coatless
Copy link
Collaborator Author

Gotcha. I think I'll probably send a quick PR to add that in. I do realize that exercise is meant to precede the more advanced OJS input selector; but, I think a lot of folks might find that useful.

Maybe, showcase the inline variable retrieval underneath the storing and recall code portion in the interactive code blocks?

https://quarto-live-dev.netlify.app/getting_started/editor#storing-and-recalling-code

@georgestagg
Copy link
Member

georgestagg commented Aug 1, 2024

showcase the inline variable retrieval underneath the storing and recall code portion in the interactive code blocks?

I'm OK with that if you'd like to include it as part of a PR.

@georgestagg georgestagg added the documentation Improvements or additions to documentation label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants