如何计算R

时间:2018-10-23 05:44:54

标签: r mean

enter image description here

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

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

  

BILL_AMT <-,其中包括所有BILL_AMT值的平均值。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

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

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

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

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

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