[R] how to count the columns of a data.frame

David Howell David.Howell at uvm.edu
Fri Apr 14 19:49:27 CEST 2006


That was not a very helpful reply to someone who asked a question. He could
be counting the rows by asking for the length of a full variable in that
data frame, and not be aware of nrow(x). And one could know about nrow()
without knowing about its page in the manual..

There is no need to jump all over someone who asks a question--some people
are just starting out.




On 4/14/06 11:16 AM, "Berton Gunter" <gunter.berton at gene.com> wrote:

>> 
>> Hi,
>>   I would like to count the columns of a data.frame. I know
>> how to count the rows, but not the columns.
> 
> ...
> 
> If you knew how to count the rows, you would have known about nrow which has
> the same man page as ncol. Also help.search('number of rows') would have
> immediately given you your answers. So please do your homework before
> posting in future by using R's extensive built-in documentation.
> 
> -- Bert Gunter
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list