3

How do I force dplyr to show all columns and rows of a rather small data.frame. The ddf object below, for example:

df = data.frame(a=rnorm(100), b=c(rep('x', 50), rep('y', 50)), c=sample(1:20, 100, replace=T), d=sample(letters,100, replace=T), e=sample(LETTERS,100,replace=T), f=sample("asdasdasdasdfasdfasdfasdfasdfasdfasdfasd asdfasdfsdfsd", 100, replace=T))
ddf= tbl_df(df)
JJJ
  • 1,009
  • 6
  • 19
  • 31
biocyberman
  • 5,675
  • 8
  • 38
  • 50
  • 2
    Possible duplicate of [View entire data frame when wrapped in tbl\_df?](https://stackoverflow.com/questions/23188900/view-entire-data-frame-when-wrapped-in-tbl-df) – smci May 19 '18 at 09:31

4 Answers4

7

if you want to still use dplyr and print your dataframe just run

print.data.frame(ddf)
ddf
MLavoie
  • 9,671
  • 41
  • 36
  • 56
3

Ah, I was getting angry with dplyr therefore I could not see. the solution is simple: as.data.frame(ddf). That is to convert dplyr-backed data.frame to generic data.frame.

biocyberman
  • 5,675
  • 8
  • 38
  • 50
1

You can use the function print and adjust the n parameter to adjust the number of rows to show.

For example, the following commdands will show 20 rows.

print(ddf, n = 20)

You can also use the typical dplyr pipe syntax.

ddf %>% print(n = 20)

If you want to show all rows, you can use n = Inf (infinity).

print(ddf, n = Inf)
ddf %>% print(n = Inf)
Sven Hohenstein
  • 80,497
  • 17
  • 145
  • 168
0

From the docs:

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. Use options(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.

glenn
  • 271
  • 2
  • 6