在小标题中查看超过10行时遇到问题 [英] Having trouble viewing more than 10 rows in a tibble
问题描述
首先-我是R和R编程的初学者,请问这是一个愚蠢的问题。我无法查看由以下代码生成的小标题中的十多行。
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.
以下代码旨在查找一本书中最常见的单词。我得到了想要的结果,但是如何查看超过10行的数据。据我所知,它并没有保存为我可以调用的数据框。
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
推荐答案
当我想查看类似这样的管道的输出时,我经常做的就是将其直接管道传输到 View( )
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)
这篇关于在小标题中查看超过10行时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!