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
What I often do when I want to see the output of a pipe like that is pipe it straight to View()
library(dplyr)
library(tidytext)
tidy_books %>%
anti_join(stop_words) %>%
count(word, sort=TRUE) %>%
View()
If you want to save this to a new object that you can work with later, you can assign it to a new variable name at the beginning of the pipe.
word_counts <- tidy_books %>%
anti_join(stop_words) %>%
count(word, sort=TRUE)
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 want to stay in the console, then note that tibbles have print S3 methods defined so you can use options such as (see ?print.tbl
):
very_long <- as_tibble(seq(1:1000))
print(very_long, n = 3)
# A tibble: 1,000 x 1
value
<int>
1 1
2 2
3 3
# ... with 997 more rows
Note, tail
doesn't play with tibbles, so if you want to combine tail
with tibbles to look at the end of your data, then you have to do something like:
print(tail(very_long, n = 3), n = 3)
# A tibble: 3 x 1
value
<int>
1 998
2 999
3 1000