News for hackers. Stuff that matters.
Re:A newcomer’s (angry) guide to R by ryanmonroe on Wednesday June 13, 2018 @05:26PM (#17307097)
What is needlessly complex about length, nrow, and dim and why would they ever give you the wrong thing? length always gives the length of an object, i.e. the number of elements in it[1]. nrow will always give the number of rows, and dim will always give the dimensions e.g. for a data.frame with 3 rows and 4 columns dim(df) is (3, 4).

[1]That is, top-level elements. If a list L contains 3 vectors, each with 9 elements, length(L) is 3, not 9 or 9*3 = 27

There are no comments on this comment yet.