I would like to integrate some old matlab scripts into an .Rmd document for my thesis to avoid the copy-pasting that knitr tries to avoid anyways. Is this possible? Using http://yihui.name/knitr/demo/engines/ I was able to integrate python code no problem, but matlab is a lot more difficult.
knitr
has been updated and actual version, 1.15.1, allows more supported engines: octave is one of them:
library(knitr)
names(knit_engines$get())
[1] "awk" "bash" "coffee" "gawk" "groovy"
[6] "haskell" "lein" "mysql" "node" "octave"
[11] "perl" "psql" "python" "Rscript" "ruby"
[16] "sas" "scala" "sed" "sh" "stata"
[21] "zsh" "highlight" "Rcpp" "tikz" "dot"
[26] "c" "fortran" "fortran95" "asy" "cat"
[31] "asis" "stan" "block" "block2" "js"
[36] "css" "sql"
To add octave code in a Rmarkdown notebook use:
```{octave}
# Insert your octave code here
```
The currently supported engines by knitr are
> require(knitr);
names(knit_engines$get())
[1] "awk" "bash" "coffee" "gawk" "haskell" "perl" "python" "Rscript" "ruby" "sas"
[11] "sed" "sh" "zsh" "highlight" "Rcpp" "tikz" "dot" "c" "asy" "cat"
So yes, matlab is not currently supported as knitr engine but maybe this (Convert MATLAB code to R) could help in porting matlab code to R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With