[R] colMeans function
ru|pb@rr@d@@ @end|ng |rom @@po@pt
Wed Nov 4 18:19:48 CET 2020
No, flights is *not* equal to flights$months. The former is a
data.frame with only one column, therefore it has a dimension attribute.
The latter is a column, a vector of the data.frame flights, it does not
have the attribute dim set.
The difference is very important, see what class(), str() or dim()
return when applied to both.
See also this StackOverflow post:
Hope this helps,
Às 13:26 de 04/11/20, Engin Yılmaz escreveu:
> I use *flights* database library(nycflights13)
> The following code is working as
> * 6.54851*
> but other code is not working as
> *Error in colMeans(flights$month) : *
> * 'x' must be an array of at least two dimensions*
> *flights* is equal to the *month *column in database
> Engin YILMAZ
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help