在Knitr

时间:2015-08-06 12:51:12

标签: r latex rstudio knitr

编译以下文档时我有一个奇怪的问题。 se.ranef(model)se.fixef(model)R中工作正常。但是,如下图所示,突然间,他们找不到了。出了什么问题,拜托?有人可以帮帮我吗?谢谢!

enter image description here

\documentclass[english]{exam}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{bigints}
\usepackage[stable]{footmisc}
\usepackage{ulem}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{booktabs}
\usepackage{pdfpages}

\printanswers
\unframedsolutions

\begin{document}

\begin{questions}

\question 

\begin{solution}

<<>>=
library(lme4)
X <- 1:24
coag <- c(62, 60, 63, 59, 63, 67, 71, 64, 65, 66, 68, 66, 
          71, 67, 68, 68, 56, 62, 60, 61, 63, 64, 63, 59)
diet <- c("A", "A", "A",  "A",  "B",  "B",  "B",  "B",  "B",  "B", "C", 
          "C", "C", "C", "C", "C", "D", "D", "D", "D",  "D", "D", "D", "D")
#coag <- data.frame(cbind(X, coag, diet))
#coag <- read.table("coag.csv", sep=",", header=TRUE)
model <- lmer(coag~(1|diet))
@

<<>>=
se.ranef(model)
@

<<>>=
se.fixef(model)
@

\end{solution}

\end{questions}

\end{document}

1 个答案:

答案 0 :(得分:4)

se.fixefse.ranef不是来自base或nlme的函数。 <{1}}在您运行时会启动一个新环境,因此不会加载任何其他包。

尝试首先加载您从中获取的库,将其添加到加载knitr

的位置
nlme