我的输出包含10行以上,但dplyr仅显示10行。我需要显示所有输出行。
我正在Mac上使用RStudio。
我使用以下代码加载了数据:
> allstarmets <- read.csv("All-Star-games-Mets.csv", stringsAsFactors = FALSE)
这是CSV文件中的前16行(CSV包含122行,包括标题行):
playerID yearID gameNum gameID teamID lgID GP startingPos
1 ashburi01 1962 1 ALS196207100 NYN NL 0 NA
2 ashburi01 1962 2 NLS196207300 NYN NL 1 NA
3 snidedu01 1963 0 ALS196307090 NYN NL 1 NA
4 huntro01 1964 0 NLS196407070 NYN NL 1 4
5 kraneed01 1965 0 ALS196507130 NYN NL 0 NA
6 huntro01 1966 0 NLS196607120 NYN NL 1 NA
7 seaveto01 1967 0 ALS196707110 NYN NL 1 NA
8 groteje01 1968 0 NLS196807090 NYN NL 1 2
9 koosmje01 1968 0 NLS196807090 NYN NL 1 NA
10 seaveto01 1968 0 NLS196807090 NYN NL 1 NA
11 jonescl01 1969 0 ALS196907230 NYN NL 1 7
12 koosmje01 1969 0 ALS196907230 NYN NL 1 NA
13 seaveto01 1969 0 ALS196907230 NYN NL 0 NA
14 harrebu01 1970 0 NLS197007140 NYN NL 1 NA
15 seaveto01 1970 0 NLS197007140 NYN NL 1 1
这是我代码的主要部分:
allstarmets2 <- allstarmets
> allstarmets2 %>%
+ group_by(yearID) %>%
+ summarize(n())
这是我运行整个CSV文件时显示的内容。我需要查看所有行,而不仅仅是前十行。
# A tibble: 57 x 2
yearID `n()`
<int> <int>
1 1962 2
2 1963 1
3 1964 1
4 1965 1
5 1966 1
6 1967 1
7 1968 3
8 1969 3
9 1970 2
10 1971 2
# … with 47 more rows