How to view more than 10 rows for a table in RStudio Notebook

356 Views Asked by At

I'm using RStudio's R Notebook and would like to view 12 rows in my table, rather than have it limited to 10. I know you can click through to see the last two but I'd like to show all 12.

I have tried:

head(table_name, 12)

but that doesn't work. Any ideas?

thanks!

example table showing only 10 or the 12 rows

1

There are 1 best solutions below

0
Peter On

Options with {knitr} or {DT}:

With {knitr}

```{r}
library(knitr)
kable(head(iris, 12))
```

Gives you:

enter image description here

Or with {DT}:

```{r dt}

library(DT)
datatable(head(iris, 12),  options = list(pageLength = 12))
```

enter image description here