为什么下面返回的输出是data frame with 0 columns and 1 row,我也不知道这是什么意思。
运行的代码是
iris %>% summarise(across(everything(),nrow)) 请注意,下面这两个代码都会按预期返回输出
iris %>% summarise(across(everything(),length))
iris %>% summarise(across(everything(),mean))接收的理想输出
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
150 150 150 150 150发布于 2021-04-25 14:04:49
nrow在数据帧上使用,across不会将数据作为数据帧传递,而是将其作为nrow不起作用的向量传递。例如,
nrow(1:10)
#NULL你可以使用像length,NROW这样的函数来处理across中的向量。
https://stackoverflow.com/questions/67250247
复制相似问题