Comments (5)
Thank you for the quick reply. Although that is not the exact issue, it did point me in the right direction. I am not very familiar with quarto but it does seem that in interactive mode, knitr is doing the job of executing the cells. I'll try to illustrate the issue here, as it might be helpful to others (or at least me in the future!)
It seems that knitr creates a temporary sh
file with the following content and tries to call that from the default shell.
{engine} /tmp/tempfilename.txt
So it enters Stata in normal (not batch mode) and it never returns any output or error until I cancel the call via the stop button, when I can then see Stata's splash and the error (/ is not a valid command
). See, for example, if I rename the engine to something random:
Having said that, there is indeed a knitr engine called stata
. So I don't know why that is not being called. I did set jupyter (and nbstata as the kernel) when creating the document (see next screenshot).
Having said all that, it is very likely that the issue is either with quarto or with knitr. I'll try to figure it out, and I'll link back to this issue any relevant info I find.
By the way (not relevant to this issue) I also opened an issue in quarto's repository asking about support for nbstata
. Is there any documentation on using nbstata
with quarto (from VSCode or any other editor?).
from nbstata.
One possible workaround would be setting a custom knitr engine and trying to make sure it points to python (jupyter) and uses nbstata
. (here for context: https://bookdown.org/yihui/rmarkdown-cookbook/custom-engine.html)
Disclaimer: that I have a very shallow understanding of how knitr and jupyter kernels work.
And here is a minumum reproducible example of a document.
---
title: "nbstata"
format: html
jupyter: nbstata
---
## nbstata
```{stata}
di 1 + 1
```
Note that the document does not include the usual knitr setup chunk that a Rmarkdown usually includes.
from nbstata.
That's great that quarto is now supporting nbstata! I just did a quick test with simple documents, and it ran fine on VSCode (interactive execution and compilation).
On RStudio the conflict between the default stata
engine (from knitr) and nbstata
via jupyter
is still present. However! I found out a few weeks ago that due to Fedora's packaging guidelines, quarto
is not bundled-up with RStudio as distributed by Fedora (see: rstudio/rstudio#12609). So I am not sure if the conflict is only in Fedora distributions or a more generic issue.
In any case, a quarto document with nbstata
kernel can be compiled with quarto::quarto_render("file.qmd")
from R or with quarto render file.qmd
from the terminal. The source file can be edited from RStudio but (at least in my system) interactive code execution does not work. If I get the chance to play with another distribution, I'll make sure to test it and report back.
from nbstata.
Thank you for reporting. I think that when you run stata interactively in RStudio, it's not actually using nbstata.[1] I bet you're using the knitr version of Stata instead (about which I only have a vague awareness). Maybe Stata 18 broke something about how knitr stata worked? I think you should instead report this to the knitr project (but do report back if you would).[2]
By contrast, according to my hypothesis, when you render using Quarto, it is using nbstata and working.
[1] One clue is that the Stata "splash," that several-line display of the Stata version and so on, is disabled by default in nbstata. It's also hard for me to imagine how nbstata could trigger an error like that.
[2] An additional piece of info that may be helpful to them is the Stata revision date.
from nbstata.
Thank you, @avila, for that quarto issue which led to nbstata support in the Quarto VSCode extension.
I'd like to add further documentation directing people toward that extension (and also how to use nbstata with RStudio if there is a way), but I won't have time to work on it myself until July at the earliest.
from nbstata.
Related Issues (20)
- Kernel crashes with certain comments HOT 1
- Request: conda-forge package HOT 1
- invalid config options HOT 2
- `%help` triggers an unhandled error
- Ease setting figure dimensions in-line HOT 3
- %head fails with "head failed. must be real number, not str" HOT 7
- New animated gif, specific to nbstata HOT 1
- XDG spec for config files HOT 7
- Tabs vs Spaces HOT 8
- Add config file location to %status magic output
- Add a Stata Quarto tutorial HOT 5
- Improve ability to initialize Stata automatically HOT 1
- Display config file errors in notebook HOT 7
- Config file saved at custom location (by `install --prefix`) ignored
- Add docs about using as alternative to 'stata_setup' package
- Broken link in documentation HOT 1
- Stata 18.5/Now support
- RStudio + Quarto Error HOT 3
- Can't find the stata installation path HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbstata.