使用不同因素水平的应用族的汇总统计数据 [英] Summary statistics using apply family for different factor levels

查看:44
本文介绍了使用不同因素水平的应用族的汇总统计数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找不同因素水平的摘要统计信息.

I am trying to find the summary statistics for different factor levels.

data.frame(apply(final_data[Company=="BPO",c(66:84)],2,summary))  

现在我为 company 提供了不同的值-我可以为不同的值重复该语句.我知道它可以自动化-使用Apply系列( ddply tapply sapply ),但我做得不好.

Now I have different values for company - i can repeat the statement for different values. I know it can be automated - using apply family (ddply,tapply,sapply), but I am not getting it right.

推荐答案

您可以拆分公司,然后使用您的函数:

You could split on company and then use your function:

spl = split(final_data, final_data$Company)
list.of.summaries = lapply(spl, function(x) data.frame(apply(x[,66:84], 2, summary)))

这篇关于使用不同因素水平的应用族的汇总统计数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆