如何计算R中的组合列平均值 [英] how to calculate combined column mean value in R

查看:154
本文介绍了如何计算R中的组合列平均值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个有代表性的组合栏并计算均值.

I want to make representative combined column and calculate mean.

例如,有BILL_AMT(1,2,3,4,5,6). 但我要

for example, there are BILL_AMT(1,2,3,4,5,6). but i want

BILL_AMT<-包括所有BILL_AMT值的平均值.

BILL_AMT <- which includes mean value of all BILL_AMT values.

我该怎么办?

推荐答案

请提供数据的可复制示例.

Please provide a reproducible example of your data.

只需假设您要执行的操作即可:

Just assuming what you're trying to do:

data <- data.frame(x = rep(1:10,1), y = rep(11:20, 1))

data %>% 
  rowwise() %>% 
  mutate(mean = mean(x + y + ...))

根据您的评论:填写x + y + ...

这篇关于如何计算R中的组合列平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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