首页 > 解决方案 > R 包 dplyr 中的主要功能对我不起作用

问题描述

library(dplyr)

x <- 1:10

lead(x)

运行上面的代码只会给我以下错误:

"UseMethod("lead") 中的错误:没有适用于 'lead' 的方法应用于类 "c('integer', 'numeric')" 的对象

我已经尝试了很多类似 as.numeric 和 as.vector 的东西,但我一直收到这个错误。

标签: rdplyrlead

解决方案


推荐阅读