我正在通过pandoc为协作者在Rstudio中生成HTML报告。但是,当尝试为sink
对象的以下摘要生成输出时,pander正在达到R中的lm()
限制。
我的R实例:
版本 _
平台x86_64-apple-darwin13.1.0
拱x86_64
os darwin13.1.0
system x86_64,darwin13.1.0
状态
专业3 小1.0 2014年 月04日 第10天 svn rev 65387
语言R
version.string R版本3.1.0(2014-04-10) 绰号春舞
我正试图从lm
生成HTML:
summary(a.lm)
Call:
lm(formula = f.t ~ ((b.c + I(a.c^2) + b.t.c +
c.c) * (PTGENDER + DX.bl + Al1.Al2)) + BMI.t.c + FH.t.c +
Hb.t.c + age.c + I(age.c^2), data = subset(d,
!is.na(Hb.t.c) & !is.na(BMI.t.c) & !is.na(b.t.c) & !is.na(c.c)))
Residuals:
Min 1Q Median 3Q Max
-0.72042 -0.15865 -0.01311 0.15826 0.91421
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.6247957 0.1120717 14.498 < 2e-16 ***
a.c 0.1343279 0.1481459 0.907 0.36541
I(a.c^2) -0.0312254 0.0537683 -0.581 0.56193
b.t.c 0.1040226 0.0782932 1.329 0.18516
c.c 0.2012898 0.0818699 2.459 0.01461 *
PTGENDERFemale 0.0067323 0.0473586 0.142 0.88707
DX.blLMCI -0.0121387 0.0553348 -0.219 0.82654
DX.blAD 0.0209534 0.0769331 0.272 0.78557
Al1.Al23:3 0.1658594 0.1075438 1.542 0.12426
Al1.Al23:4 0.3506150 0.1121648 3.126 0.00198 **
Al1.Al24:4 0.1386058 0.1690946 0.820 0.41316
BMI.t.c -0.0280475 0.0182582 -1.536 0.12574
FH.t.c 0.0031254 0.0225851 0.138 0.89005
Hb.t.c 0.0162085 0.0171502 0.945 0.34551
age.c 0.0024730 0.0028751 0.860 0.39052
I(age.c^2) 0.0003961 0.0002926 1.354 0.17706
a.c:PTGENDERFemale 0.0303573 0.0474341 0.640 0.52276
a.c:DX.blLMCI 0.1143316 0.0603606 1.894 0.05934 .
a.c:DX.blAD 0.1406856 0.0691761 2.034 0.04302 *
a.c:Al1.Al23:3 -0.0369030 0.1472692 -0.251 0.80234
a.c:Al1.Al23:4 -0.0493593 0.1469924 -0.336 0.73730
a.c:Al1.Al24:4 -0.0688362 0.1564964 -0.440 0.66041
I(a.c^2):PTGENDERFemale -0.0584777 0.0324483 -1.802 0.07270 .
I(a.c^2):DX.blLMCI 0.0298364 0.0368905 0.809 0.41940
I(a.c^2):DX.blAD 0.0147823 0.0440503 0.336 0.73747
I(a.c^2):Al1.Al23:3 0.0001684 0.0586422 0.003 0.99771
I(a.c^2):Al1.Al23:4 -0.0357507 0.0621727 -0.575 0.56578
I(a.c^2):Al1.Al24:4 -0.0328713 0.0664954 -0.494 0.62149
b.t.c:PTGENDERFemale 0.0208930 0.0466606 0.448 0.65470
b.t.c:DX.blLMCI -0.0640037 0.0628767 -1.018 0.30968
b.t.c:DX.blAD -0.0607185 0.0705763 -0.860 0.39042
b.t.c:Al1.Al23:3 -0.0428761 0.0727674 -0.589 0.55624
b.t.c:Al1.Al23:4 -0.0289522 0.0729465 -0.397 0.69178
b.t.c:Al1.Al24:4 -0.0946543 0.0981224 -0.965 0.33564
c.c:PTGENDERFemale 0.0193275 0.0445454 0.434 0.66474
c.c:DX.blLMCI -0.0371738 0.0470631 -0.790 0.43034
c.c:DX.blAD -0.1221799 0.0722145 -1.692 0.09189 .
c.c:Al1.Al23:3 -0.1604799 0.0798383 -2.010 0.04548 *
c.c:Al1.Al23:4 -0.2015401 0.0871098 -2.314 0.02149 *
c.c:Al1.Al24:4 -0.3374309 0.1520609 -2.219 0.02737 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2795 on 254 degrees of freedom
Multiple R-squared: 0.4536, Adjusted R-squared: 0.3697
F-statistic: 5.406 on 39 and 254 DF, p-value: < 2.2e-16
运行:
pander(summary(a.lm))
导致以下错误
Error in sink(file) : sink stack is full
非常感谢任何克服这一点的建议。
干杯
回应弗里克先生
是的,似乎:
以下是一个例子:
d <- data.frame(a = rnorm(20), b = sample(letters[1:2], 20, replace = TRUE))
pander(summary(lm(a ~ b, data = d)))
Error in sink(file) : sink stack is full
pander(lm(a ~ b, data = d))
--------------------------------------------------------------
Estimate Std. Error t value Pr(>|t|)
----------------- ---------- ------------ --------- ----------
**bb** -0.1637 0.3797 -0.4311 0.6715
**(Intercept)** -0.1634 0.2401 -0.6805 0.5049
--------------------------------------------------------------
Table: Fitting linear model: a ~ b
所以删除摘要调用有效:)
答案 0 :(得分:1)
实际上,如果您只是运行标准lm
回归,请不要将summary.lm
对象传递给pander
,传递模型本身(lm
对象)
pander(a.lm)
那应该有您需要的信息。该函数在内部调用summary()
。