r:dplyr mutate错误二进制运算符的非数字参数

时间:2016-03-06 17:57:56

标签: r dplyr

在data.frame(list)上的dplyr中尝试mutate但是得到一个错误:二元运算符的非数字参数。尝试按时延迟转换'数字但仍然得到错误,代码中是否有错误?

list$delayed <- as.numeric(as.character(list$delayed))
list$'on time' <- as.numeric(as.character(list$'on time'))

list <- mutate(list, total = delayed + 'on tine', pctdelay = delayed / total * 100)

   Carrier  City         delayed on time
1  Alaska   Los Angeles      62     497
2  Alaska       Phoenix      12     221
3  Alaska     San Diego      20     212
4  Alaska San Francisco     102     503
5  Alaska       Seattle     305    1841
6 AM WEST   Los Angeles     117     694

0 个答案:

没有答案