Emulate split() with dplyr group_by: return a list of data frames

前端 未结 6 586
忘掉有多难
忘掉有多难 2020-11-29 06:07

I have a large dataset that chokes split() in R. I am able to use dplyr group_by (which is a preferred way anyway) but I am unable to persist the r

6条回答
  •  情深已故
    2020-11-29 06:35

    To 'stick' to dplyr, you can also use plyr instead of split:

    library(plyr)
    
    dlply(df, "V1", identity)
    #$a
    #  V1 V2 V3
    #1  a  1  2
    #2  a  2  3
    
    #$b
    #  V1 V2 V3
    #1  b  3  4
    #2  b  4  2
    
    #$c
    #  V1 V2 V3
    #1  c  5  2
    

提交回复
热议问题