Calculating subtotals in R

后端 未结 7 1703
北荒
北荒 2021-02-15 11:28

I have a data frame with 900,000 rows and 11 columns in R. The column names and types are as follows:

column name: date / mcode / mname / ycode / yname / yissue          


        
7条回答
  •  我在风中等你
    2021-02-15 11:49

    Or the plyr library, which is easily extensible to other data classes:

    > library(plyr)
    > result.2 <- ddply(df$a, .(df$b), sum)
    > result.2
      df.b V1
    1 down 30
    2   up 25
    

提交回复
热议问题