I am in the middle of generating a HTML report in Rstudio via pandoc for a collaborator. However pander is hitting the sink
limit in R when trying to generate the output for the following summary of a lm()
object.
My R instance:
version _
platform x86_64-apple-darwin13.1.0
arch x86_64
os darwin13.1.0
system x86_64, darwin13.1.0
status
major 3
minor 1.0
year 2014
month 04
day 10
svn rev 65387
language R
version.string R version 3.1.0 (2014-04-10) nickname Spring Dance
The lm
I am trying to generate the HTML from:
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
running:
pander(summary(a.lm))
leads to the following error
Error in sink(file) : sink stack is full
Any suggestions to overcome this would be much appreciated.
Cheers
In response to Mr Flick
Yes it seems to:
Here is an example:
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
So dropping the summary call works :)
lm
models? If not, can you produce a minimal sample data set that will reproduce this error? See how to make a great R reproducible example for tips on how to do that. – Governancepander
: github.com/Rapporter/pander/issues/94 – Takamatsu