Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 .Rnw 文件中有一个代码块,如下所示:
<<test, results = "asis">>= stargazer(mtcars, notes = c($n$ = \\Sexpr{nrow(mtcars)}) @
当我使用knitr评估 R 代码并将 .Rnw 文件转换为 .tex 文件时,我该如何nrow(mtcars)评估?
knitr
nrow(mtcars)
我相信你想要这样的东西:
\documentclass{article} \begin{document} <<test, results = "asis">>= library("stargazer") stargazer(mtcars, notes = paste('$n$ = ',nrow(mtcars))) @ \end{document}
您不能Sexpr在代码块中放置一个。
Sexpr