【发布时间】:2020-03-19 14:55:26
【问题描述】:
我想从 nycflights 中的来源(EWR、JFK 和 LGA)找出平均 air_time 是多少,但我收到一条错误消息,指出该对象不存在。
library(tidyverse)
library(nycflights13)
flights %>% select(air_time) (doing this shows that the column exists and with values)
现在尝试像下面这样计算平均值,给我一个错误
flights %>% select(mean(air_time))
Error: object 'air_time' not found
Run `rlang::last_error()` to see where the error occurred.
尝试运行:rlang::last_error() 它只是打印一个令人困惑的跟踪,并说 air_time 不存在,即使它确实存在。
起初我想可能是因为air_time 的类型为 dbl (double),并且我无法在 double 上运行 mean(..),但尝试 mean(1:10.4) 会产生 5.5,所以情况并非如此。非常欢迎任何帮助
【问题讨论】:
标签: r