[R] ncol() vs. length() on data.frames

Ivan Calandra c@|@ndr@ @end|ng |rom rgzm@de
Tue Mar 31 14:47:54 CEST 2020


Dear useRs,

I have a very simple question:
On a simple data.frame (i.e. each element is a vector), ncol() and
length() will give the same result.

Are they just equivalent on such objects, or are they differences in
some cases?
Is one of them to be preferred for whatever reason?

Thanks you,
Ivan

-- 
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra



More information about the R-help mailing list