作者:syingjin | 来源:互联网 | 2022-12-08 19:11
我真的不得到FUN.VALUE
的参数vapply
。这是我的示例:
a = list(list(1,2), list(1), list(1,2,3))
# give the lengths of each list in a
sapply(a, length)
现在,我尝试使用vapply
代替sapply
# gives me same result as sapply
vapply(a, length, FUN.VALUE=1)
# same result, but why?
vapply(a, length, FUN.VALUE=1000)
# gives me error
vapply(a, length, FUN.VALUE="integer")
# gives me error
vapply(a, length, FUN.VALUE="vector")
# gives me error
vapply(a, length, FUN.VALUE=c(1,2))
据?vapply
我了解,它FUN.VALUE
可以是标量,向量或矩阵,并且用于匹配输出的类型。任何暗示为什么vapply
会这样表现?