Search code examples
rrstudioknitrr-markdown

RMarkdown: Option to control number of results per page in SQL results?


I've written an SQL chunk in my RMarkdown document:

```{sql, connection = con, max.print = 300}
      select * from myTable
```

This prints 300 rows as expected in a pretty table when I run the chunk within RStudio.

However, I'd like to be able to control how many results show up on the first page of the printed table--right now, RStudio displays 10 rows per page along with page controls to jump to whatever page I'm interested in.

Is there a code chunk option I can use to control how many results are displayed per page in the results table?

For whatever it's worth, I'm really only interested in in-line code execution--I don't really care about what happens when I knit the document, only what appears when I run the chunk within RStudio.


Solution

  • You can try something like this (changing 25 to the number of rows you're after):

    ```{sql, connection = con, rows.print = 25}
    select * from myTable
    ```
    

    You can find more chunk options here.