99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2018-11-03 閱讀量: 857
分組新變量

雖然與 summarize() 函數(shù)結(jié)合起來(lái)使用是最有效的,但分組也可以與 mutate() 和 filter()

函數(shù)結(jié)合,以完成非常便捷的操作。

? 找出每個(gè)分組中最差的成員:

flights_sml %>%
group_by(year, month, day) %>%
filter(rank(desc(arr_delay)) < 10)
#> Source: local data frame [3,306 x 7]
#> Groups: year, month, day [365]
#>
#> year month day dep_delay arr_delay distance
#> <int> <int> <int> <dbl> <dbl> <dbl>
#> 1 2013 1 1 853 851 184
#> 2 2013 1 1 290 338 1134
#> 3 2013 1 1 260 263 266
#> 4 2013 1 1 157 174 213
#> 5 2013 1 1 216 222 708
#> 6 2013 1 1 255 250 589
#> # ... with 3,300 more rows, and 1 more variables:
#> # air_time <dbl>

? 找出大于某個(gè)閾值的所有分組:

popular_dests <- flights %>%
group_by(dest) %>%
filter(n() > 365)
popular_dests
#> Source: local data frame [332,577 x 19]
#> Groups: dest [77]
#>
#> year month day dep_time sched_dep_time dep_delay
#> <int> <int> <int> <int> <int> <dbl>
#> 1 2013 1 1 517 515 2
#> 2 2013 1 1 533 529 4
#> 3 2013 1 1 542 540 2
#> 4 2013 1 1 544 545 -1
#> 5 2013 1 1 554 600 -6
#> 6 2013 1 1 554 558 -4
#> # ... with 3.326e+05 more rows, and 13 more variables:
#> # arr_time <int>, sched_arr_time <int>,
#> # arr_delay <dbl>, carrier <chr>, flight <int>,
#> # tailnum <chr>, origin <chr>, dest <chr>,
#> # air_time <dbl>, distance <dbl>, hour <dbl>,
#> # minute <dbl>, time_hour <dttm>
6.8974
1
關(guān)注作者
收藏
評(píng)論(0)

發(fā)表評(píng)論

暫無(wú)數(shù)據(jù)
推薦帖子