I am working on a package that helps automate exploratory data analysis by creating a knitr file with basic statistics about each column of a dataframe. One issue I've run into is storing the result of a pander_return
call in a function and then using that output later in a knitr document. A quick example below of the issue in a markdown file:
```{r, results='asis', message=FALSE, warning=FALSE}
require(pander)
x <- pander_return(head(cars))
cat(x)
```
I'm having a lot of trouble outputting x
in a readable way. I've tried various forms of cat
and print
. For example, the code above produces the following output:
1 “————–speed dist ——- ——4 2 4 10 7 4 7 22 8 16 9 10 ————–” attr(,“class”) 1 “knit_asis” attr(,“knit_cacheable”) 1 TRUE
I would like to be able to see a standard output, like the one produced by:
```{r, results='asis', message=FALSE, warning=FALSE}
pander(head(cars))
```
I've attached a screen shot as well.
Thank you in advance for your help