简体   繁体   中英

Is there a way to do ROLLUP or CUBE in R like in sql?

Is there a way to summarize data in R using functions like ROLLUP and CUBE in sql?

If so could someone point me in the direction of an example?

使用内置数据集CO2尝试以下操作:

as.data.frame(addmargins(xtabs(uptake ~ Plant + Type + Treatment, CO2)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM