I like you package, Congratulation.
I am using R and Python, as you know we can run codes inside .Rmd file,
see
https://rwebapps.ocpu.io/markdownapp/www/
Unfortunately, your package can not run codes. I am wondering if you have plan to add this feature to your package.
Running code chunks in markdown-preview-enhanced is supported, although with a slightly different syntax. What could be improved?
Wonderful, good job.
There are two issues,
1) It does not show plot of R?
2) The new chunk, rerun new Rscript, so does not load the codes that already run in the previous chuck.
see below.
```R {cmd="/usr/local/bin/Rscript"}
output <- rnorm(30);
output
hist(output)
The normal distribution has the typical bell shape:
```Rscript {cmd="/usr/local/bin/Rscript"}
output
This is indeed an issue, because this extension requires the file to be printed to stdout. However,
it seems that Rscript cannot do that easily.
Using this solution one can force the files to be printed to stdout.
`
R {cmd="Rscript"}
dev_stdout = function (underlying_device = svg, ...) {
filename = tempfile()
underlying_device(filename, ...)
filename
}
dev_stdout_off = function (filename) {
dev.off()
on.exit(unlink(filename))
fake_stdout = pipe('cat', 'wb')
on.exit(close(fake_stdout), add = TRUE)
writeBin(readBin(filename, 'raw', file.info(filename)$size), fake_stdout)
}
tmp_dev = dev_stdout()
plot(iris)
dev_stdout_off(tmp_dev)
```
````
Most helpful comment
This is indeed an issue, because this extension requires the file to be printed to stdout. However,
it seems that Rscript cannot do that easily.
Using this solution one can force the files to be printed to stdout.
`
R {cmd="Rscript"}dev_stdout = function (underlying_device = svg, ...) {
filename = tempfile()
underlying_device(filename, ...)
filename
}
dev_stdout_off = function (filename) {
dev.off()
on.exit(unlink(filename))
fake_stdout = pipe('cat', 'wb')
on.exit(close(fake_stdout), add = TRUE)
writeBin(readBin(filename, 'raw', file.info(filename)$size), fake_stdout)
}
tmp_dev = dev_stdout()
plot(iris)
dev_stdout_off(tmp_dev)
```
````