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
options(tibble. width = Inf) # displays all columns. options(tibble. print_max = Inf) # to show all the rows.
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.
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.
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))
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