Yann Mauon wrote:
> Hello, 
> 
> I'am new to the R world and have a lot of question but the first is : How to
> deal with <> opertor in table objects? (Or how to deal with <> in
> general...) I explain my problem. 
> 
> I read a file with the read.table expression. I then obtain a matrix. I read
> the first line for example with the commande data[,1]. Then I would like to
> select only the element in this line that are greater than 2. Is there an
> elegant way to achieve that ?
> 
> Thanks by advance...

  Note that read.table() returns a data frame, not a matrix.  To subset,
try this:

subset(data, data[,1] > 2)

OR

subset(data, data[,1] > 2, select=1)

  Of course, it is always nice if each column in your data frame has a
meaningful name, so it can be referred to by name rather than number.

?subset
?names

-- 
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

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to