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

2006-04-14 Thread David Howell
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" <[EMAIL PROTECTED]> 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@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

__
R-help@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


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

2006-04-14 Thread Berton Gunter
> 
> 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@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


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

2006-04-14 Thread Chuck Cleland
?ncol

ncol(data.frame(x=-1, y=0, z=1))
[1] 3

giacomo moro wrote:
> Hi,
>   I would like to count the columns of a data.frame. I know how to count the 
> rows, but not the columns.
>   Can someone tell me how to do it?
>   My best regards,
> Giacomo Moro
>
> 
>   
> -
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@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


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

2006-04-14 Thread ronggui
> da<-data.frame(x=rnorm(10),y=rnorm(10))
> ncol(da)
[1] 2

or

> dim(da)[2]
[1] 2


2006/4/15, giacomo moro <[EMAIL PROTECTED]>:
> Hi,
>   I would like to count the columns of a data.frame. I know how to count the 
> rows, but not the columns.
>   Can someone tell me how to do it?
>   My best regards,
> Giacomo Moro
>
>
>
> -
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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
>


--
黄荣贵
Deparment of Sociology
Fudan University

__
R-help@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

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

2006-04-14 Thread Ramón Casero Cañas
giacomo moro wrote:
> 
> I would like to count the columns of a data.frame. I know how to
> count the rows, but not the columns. Can someone tell me how to do
> it?

ncol(data.frame)

-- 
Ramón Casero Cañas

http://www.robots.ox.ac.uk/~rcasero/wiki
http://www.robots.ox.ac.uk/~rcasero/blog

__
R-help@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

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

2006-04-14 Thread giacomo moro
Hi,
  I would like to count the columns of a data.frame. I know how to count the 
rows, but not the columns.
  Can someone tell me how to do it?
  My best regards,
Giacomo Moro
   


-

[[alternative HTML version deleted]]

__
R-help@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