Calculating subtotals in R

后端 未结 7 1698
北荒
北荒 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:59

    You can also use xtabs or tapply:

    xtabs(cbind(bsent, breturn, tsent, treturn, csales) ~ yname, data)
    
    tapply(data$bsent, data$yname, sum)
    

提交回复
热议问题