Extending @BLT's answer, you can set n = Inf to print all rows. print (with a tibble) also has the width = and n_extra = options to control how many columns are printed, either directly or indirectly.
options(tibble. width = Inf) # displays all columns. options(tibble. print_max = Inf) # to show all the rows.
tibbles intentionally only print a few rows - you can send the result through %>% print(n = 20) to see more. The suggestion by @Marius is probably the most elegant, however you can also simply wrap your entire statement with as. data.
You could also use
print(tbl_df(df), n=40)
or with the help of the pipe operator
df %>% tbl_df %>% print(n=40)
To print all rows specify tbl_df %>% print(n = Inf)
edit 31.07.2021: in > dplyr 1.0.0
Warning message:
`tbl_df()` was deprecated in dplyr 1.0.0.
Please use `tibble::as_tibble()` instead.
df %>% as_tibble() %>% print(n=40)
You can use as.data.frame
or print.data.frame
.
If you want this to be the default, you can change the value of the dplyr.print_max
option.
options(dplyr.print_max = 1e9)
The tibble vignette has an updated way to change its default printing behavior:
You can control the default appearance with options:
options(tibble.print_max = n, tibble.print_min = m)
: if there are more than n rows, print only the first m rows. Useoptions(tibble.print_max = Inf)
to always show all rows.
options(tibble.width = Inf)
will always print all columns, regardless of the width of the screen.
examples
This will always print all rows:
options(tibble.print_max = Inf)
This will not actually limit the printing to 50 lines:
options(tibble.print_max = 50)
But this will restrict printing to 50 lines:
options(tibble.print_max = 50, tibble.print_min = 50)
As detailed out in the bookdown documentation, you could also use a paged table
mtcars %>% tbl_df %>% rmarkdown::paged_table()
This will paginate the data and allows to browse all rows and columns (unless configured to cap the rows). Example:
I prefer to turn the tibble to data.frame. It shows everything and you're done
df %>% data.frame
you can print it in Rstudio with View() more convenient:
df %>% View()
View(df)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With