Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having trouble viewing more than 10 rows in a tibble

Tags:

First off - I am a beginner at programming and R, so excuse me if this is a silly question. I am having trouble viewing more than ten rows in a tibble that is generated from the following code.

The code below is meant to find the most common words in a book. I am getting the results I want, but how do I view more than 10 rows of data. To my knowledge, it is not being saved as a data frame that I can call.

library(dplyr) tidy_books %>%     anti_join(stop_words) %>%     count(word, sort=TRUE) Joining, by = "word" # A tibble: 3,397 x 2    word       n    <chr>  <int>  1 alice    820  2 queen    247  3 time     141  4 king     122  5 head     112  6 looked   100  7 white     97  8 round     96  9 voice     86 10 tone      81 # ... with 3,387 more rows 
like image 399
Meraj Shah Avatar asked Mar 06 '18 02:03

Meraj Shah


People also ask

How do I show all rows in R markdown?

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

How do you show all rows in a Tibble?

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.

How do I see more rows in a Tibble in R?

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.


1 Answers

Although this question has a perfectly ok answer, the comment from @Marius is much shorter, so:

tidy_books %>% print(n = 100) 

As you say you are a beginner you can replace n = 100 with any number you want

Also as you are a beginner, to see the whole table:

tidy_books %>% print(n = nrow(tidy_books)) 
like image 69
Magma Avatar answered Oct 07 '22 00:10

Magma