Pivot table using grpstats

1 次查看(过去 30 天)
alpedhuez
alpedhuez 2018-1-13
Hello,
Let us I want to calculate the sum and mean of wealth for men and women.
I set Type ={men, women} and have created a pivot table using
summarytable = grpstats(dsa,'Type',{'sum','mean'})
Now I want to have sum and mean for everyone in the sample (without grouping for men and women). Please advise the next step.

回答(1 个)

Prasanth Sunkara
Prasanth Sunkara 2018-1-23
编辑:Prasanth Sunkara 2018-1-23
Hi, I understand that you want to compute the stats without using any grouping variable. It could be done as follows:
>>summarytable = grpstats(dsa, [],{'sum','mean'})
I would recommend trying out the below example first(execute this on MATLAB CMD prompt)
>>openExample('stats/SummaryStatisticsforaDatasetArrayWithoutGroupingExample')

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by