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

using both RStan and CmdStanR in quarto - code block tag cmdstan #921

Open
mitzimorris opened this issue Feb 12, 2024 · 8 comments
Open
Labels
bug Something isn't working

Comments

@mitzimorris
Copy link
Member

2 problems:

why was this needed and can it be gotten rid of?

@mitzimorris mitzimorris added the bug Something isn't working label Feb 12, 2024
@jgabry
Copy link
Member

jgabry commented Feb 12, 2024

There's no such thing as the CmdStan language but RStan is behind so in some sense there are two different languages available to R users. That (up to date syntax) was part of the motivation for CmdStanR in the first place.

Also, the stan or cmdstan tag is used by knitr to determine how the chunk is evaluated. knitr natively supports the stan tag but that uses RStan.

@jgabry
Copy link
Member

jgabry commented Feb 12, 2024

So I think we need to keep it and fix any bugs, although I don't know why it's not working all of a sudden. Maybe @bearloga (who contributed the initial PR for this) has an idea?

@mitzimorris
Copy link
Member Author

There's no such thing as the CmdStan language but RStan is behind so in some sense there are two different languages available to R users. That (up to date syntax) was part of the motivation for CmdStanR in the first place.

in which case, the tag should be cmdstanr. which is still wrong and this is a regrettable hack.

@jgabry
Copy link
Member

jgabry commented Feb 13, 2024

I’m not sure I understand your feedback. How are you proposing that we avoid this “regrettable hack”? Any suggestions would be great. We’re open to ideas for how to support both rstan and cmdstanr in these documents while preserving the functionality that users came to expect from knitr being able to execute the code chunks (that part we don’t have control of, it’s been in knitr itself for ages).

@jgabry
Copy link
Member

jgabry commented Feb 13, 2024

There definitely could be a better way, I’m just not aware of it, so if anyone has suggestions that would be very helpful.

@mitzimorris
Copy link
Member Author

mitzimorris commented Feb 13, 2024

I apologize for calling this a regrettable hack. I didn't realize that the functionality in question was code compilation, not syntax highlighting (as the Discourse post subject suggested).

my suggestion is that for code blocks which are complete programs and that the user wants to compile, the code block options be made very very explicit. in particular, you could add argument backend so that the user could choose between RStan and CmdStanR. it would help to have argument compile which defaults to FALSE so that whenever someone wants a code chunk to compile, they need to make this explicit - which it should be, because otherwise, mere snippits would generate compiler errors.

in which case, there's only one syntax tag: stan, not two - or three as I suggested earlier, although 3 - stan for syntax highlighting only, rstan and cmdstanr for compilation would also be OK. but one syntax tag makes more sense, especially since the Rstan functionality already exists (and therefore backend would default to Rstan).

depending on the backend, you could then add further compiler options.

@jgabry
Copy link
Member

jgabry commented Feb 13, 2024

No worries, and thanks for the suggestions!

@jgabry
Copy link
Member

jgabry commented Feb 13, 2024

It would be great if in the short term there were a way to just get this working like it was before (still don’t know why it stopped working), and then we could consider a replacement along the lines of what @mitzimorris is proposing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants