On 04/11/2020 8:26 a.m., Engin Yılmaz wrote:
Dear
I use *flights* database library(nycflights13)
The following code is working as
colMeans(flights[2])
* 6.54851*
but other code is not working as
colMeans(flights$month)
*Error in colMeans(flights$month) : *
* 'x' must be an array of at least two dimensions*
*flights[2]* is equal to the *month *column in database
No, flights[2] is a dataframe with one column. flights[[2]] would be
the month column.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.