[R] Odp: Operator > and <

Petr PIKAL petr.pikal at precheza.cz
Wed Jul 25 14:50:36 CEST 2007


Hi

you definitely shall make a quick glance to some documentation which comes 
with R e.g. R intro manual. Or look at CRAN where is quite impressive 
amount of literature from basic stuff to advanced papers.

To your question:

r-help-bounces at stat.math.ethz.ch napsal dne 25.07.2007 14:23:58:

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

You did not select line but column. 

data[,1] > 2 

will give you logical vector which you can use for selection of rows from 
data. 

data[data[,1] > 2,]

Regards.
Petr
 

> select only the element in this line that are greater than 2. Is there 
an
> elegant way to achieve that ?
> 
> Thanks by advance...
> -- 
> View this message in context: 
http://www.nabble.com/Operator-%3E-and-%3C-
> tf4141869.html#a11781567
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list