10

I'm working on an R markdown file. The results of analysis are shown in the form of tibble but in order to see all the columns and rows, I need to click to expand. However, since I'm going to knit the file into html, I need to display all the columns and rows in the R markdown file. I did a search and came up with the following codes:

options(tibble.width = Inf) # displays all columns.
options(tibble.print_max = Inf) # to show all the rows.

However, I don't know where to put them. I placed them before and after my code, but it didn't work. MY codes are:

  1. head(df)
  2. summarise(mean_cov= ..., median_cov=...., sd_cov=...., ...)

Thanks.

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
  • Is widening also possible for only a single column? I'm fine with some columns being collapsed, but a specific one contains an identifier which needs to be fully available for copy-pasting in the .md output. – Katrin Leinweber Oct 24 '19 at 13:11
  • 3
    I think the answer in [this question](https://stackoverflow.com/questions/40893742/r-markdown-df-print-options) is relevant. Essentially set `{r rows.print = n}` in your code chunk header. – Mxblsdl Jun 20 '20 at 17:33

4 Answers4

12

a tibble is a specific type of data.frame (try class(df)), and it has its own method to print, which is frustrating when you want the full thing.

As it's still a data.frame though you can use the method for data.frames and it will print everything, try:

print.data.frame(df)

or

print.data.frame(head(df))

or

print.data.frame(summarize...)

Note that as.data.frame will have the same output

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
7
print(your_tbl, n = 1e3)

or

your_tbl %>% print(n = 1e3)

Replace n with a number larger than the max number of rows you'll encounter. (And hopefully 1e3 = 1000 will do, since a table with even 100 rows is pretty hard to understand by eye.)

mmuurr
  • 1,310
  • 1
  • 11
  • 21
0

Or you can also use View(df) to see the data in spreadsheet format.

Peter
  • 11,500
  • 5
  • 21
  • 31
mschiffm
  • 26
  • 2
-1

try head(data.frame(df)), head(data.frame(df), 40), head(data.frame(df), 40) etc

Dawit
  • 1