【问题标题】:R error with Knitr in Lyx [duplicate]Lyx中Knitr的R错误[重复]
【发布时间】:2013-03-03 01:27:57
【问题描述】:

这是我正在使用的代码,在 Rstudio 中运行良好

a1 <- matrix(c(1601, 162527, 510, 412368), nrow=2, byrow=T)  
chisq.test(a1, correct=F)

这是我得到的错误

! Undefined control sequence.  
<argument> ^^M##^^M##  Pearson'  
s Chi-squared test^^M##^^M## data:  a1^^M## X...  
l.356 \end{verbatim}  

The control sequence at the end of the top line  
of your error message was never \def'ed. If you have  
misspelled it (e.g., `\hobx'), type `I' and the correct  
spelling (e.g., `I\hbox'). Otherwise just continue,  
and I'll forget about whatever was undefined.

如果我这样做会起作用

c1 <- chisq.test(a1, correct=F)

然后使用

调用 p 值
c1$p.value

是什么导致了这个问题?

【问题讨论】:

  • 才发现你半年前问过同样的问题...
  • 我认为另一个与重要代码有关,而这没有。
  • 这两个问题都是由单引号引起的。我很理解你没有意识到这一点。我希望结束这个问题不是因为它不是一个好问题,而是为了避免重复答案。
  • @Yihui 如何关闭问题?直接删除?
  • @SaberCN,是的,这是一种可能性。作为原始发帖者,您应该会看到删除(或关闭)它的选项。

标签: r knitr lyx


【解决方案1】:

这是一个已在development version 中修复的已知错误(请参阅NEWS)。目前,您可以从以下位置安装它:

install.packages('knitr', repos = 'http://www.rforge.net/')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-09
    • 1970-01-01
    • 2012-09-09
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 2015-07-09
    相关资源
    最近更新 更多