gpt4 book ai didi

r - xtabs 中的总 margin

转载 作者:行者123 更新时间:2023-12-04 16:30:28 25 4
gpt4 key购买 nike

如果您有 2 个交叉分类变量,您可以使用 rowSumscolSumsxtabs 上产生利润总额输出。但是,如果您有 3 个分类变量(即每个子表中的利润总额),怎么办?

最佳答案

Aniko 在评论中提到了这一点,但从未作为答案提供。

我独立找到了这个,然后在评论中注意到它在这里,所以感谢 Aniko 首先得到它。
addmargins答案是:

For a given table one can specify which of the classifying factors to expand by one or more levels to hold margins to be calculated. One may for example form sums and means over the first dimension and medians over the second. The resulting table will then have two extra levels for the first dimension and one extra level for the second. The default is to sum over all margins in the table. Other possibilities may give results that depend on the order in which the margins are computed. This is flagged in the printed output from the function.

关于r - xtabs 中的总 margin ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2566766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com