0
votes

I am generating a PDF document using Knitr. I am calling my r script from a separate file. Everything prints out fine in the PDF, but when I output a table using Stargazer, knitr generates a new page in the PDF document with "asis" printed on the page. I included a screen shot. Any ideas why this is happening?

My code chunk:

---
title: "PALS Biomarker Analysis"
author: "Daniel Parker"
date: "November 20, 2017"
output: pdf_document
header-includes:
- \usepackage{caption}
---

\captionsetup[table]{labelformat=empty}


```{r echo=FALSE}
library(knitr)
read_chunk('11-20-17 PALS Analysis V3.R')

```

```{r eighth, echo = FALSE,  results="asis"}
<<linear_model_one>>
```

If I remove the results="asis" the table does not print correctly.

enter image description here

1
Why have you got << >> round your model?user3603486
That's how I call the code chunk from the main R scriptDaniel
Looks weird... is this Rmd, Rnw or what? Shouldn't you just use the child option? Or an explicit source() command?user3603486
This is an .RMD file. I already wrote all the code in a separate script file and there is a lot of extra output that I don't want in the .pdf so I used read_chunk and separated out code chunks in the script file with ## @knitr s. Thanks.Daniel
Instead of calling the code in the chunk, I called the chunk in the header. Doing this, I was able to get rid of the "asis" call in the stargazer options, which eliminated the problem.Daniel

1 Answers

0
votes

Try changing this code

```{r eighth, echo = FALSE,  results="asis"}
    <<linear_model_one>>
```

to this (remove the double quotes surrounding asis)

```{r eighth, echo = FALSE,  results='asis'}
<<linear_model_one>>
```