user8388729
user8388729

Reputation:

displaying all the rows and columns of tibble in R-markdown

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.

Upvotes: 10

Views: 45191

Answers (4)

Dawit
Dawit

Reputation: 1

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

Upvotes: -1

mschiffm
mschiffm

Reputation: 36

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

Upvotes: 1

mmuurr
mmuurr

Reputation: 1580

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.)

Upvotes: 9

moodymudskipper
moodymudskipper

Reputation: 47300

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

Upvotes: 12

Related Questions