将MATLAB脚本集成到R Markdown文档中

vyu0f0g1  于 2022-11-30  发布在  Matlab
关注(0)|答案(2)|浏览(185)

我想把一些旧的matlab脚本集成到我的论文的.Rmd文档中,以避免knitr试图避免的复制粘贴。这可能吗?使用http://yihui.name/knitr/demo/engines/我可以集成python代码没有问题,但是matlab要困难得多。

rks48beu

rks48beu1#

knitr已更新,实际版本为1.15.1,支持更多引擎:八度音就是其中之一:

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"

要在Rmarkdown笔记本中添加八度音阶代码,请用途:

```{octave}
# Insert your octave code here
6qqygrtg

6qqygrtg2#

knitr目前支持的引擎有

> 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"

因此,是的,matlab目前不支持作为knitr引擎,但这(Convert MATLAB code to R)可能有助于将matlab代码移植到R

相关问题