mutate_impl(.data,dots)出错:评估错误:仅在数据框上定义,R中的所有数字变量都出错

时间:2018-04-19 21:59:42

标签: r

我正在尝试编写一个相当简单的代码,它给了我上面的错误消息。 暴露天数数据看起来像

groupid  Quarter ExposedDays    AboveMaxDays    PatGroup Ageband sex Country
1         1       983            0              A        0 TO 18  F   E
1         2       167           10              B        0 TO 18  F   I
1         1       435           0               C        0 TO 18  F   S
The code is as follows-

y<-ExposedDays%>%
      select(ExposedDays,AboveMaxDays,PatGroup,Ageband,sex,Country)%>%
      gather("Variable","Value",ExposedDays,AboveMaxDays)%>%
      mutate(a=sum(ExposedDays), b=sum(AboveMaxDays))

我检查了我应用mutate函数的列,它们都是数字。

0 个答案:

没有答案