[R] Vector

Petr Pikal petr.pikal at precheza.cz
Fri Apr 14 10:18:28 CEST 2006


Hi

On 13 Apr 2006 at 19:33, Gabor Csardi wrote:

Date sent:      	Thu, 13 Apr 2006 19:33:30 -0400
From:           	Gabor Csardi <csardi at rmki.kfki.hu>
To:             	Barbora Kocúrová <barbora.kocurova at atlas.cz>
Copies to:      	r-help at stat.math.ethz.ch
Subject:        	Re: [R] Vector

> Let n=20 and k=10.
> 
> > v <- 1:20
> > v[-10]
>  [1]  1  2  3  4  5  6  7  8  9 11 12 13 14 15 16 17 18 19 20
> > 
> 
> This is what you want?
> 
> Gabor

or maybe this?

> v <- runif(20)*50
> n <- length(v)
> v<n
 [1] FALSE FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE  TRUE  TRUE  
TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

> v[v<n]
[1] 19.999718 16.267608 10.134613  6.084596 12.274426  7.165219 
11.981471  2.946719

> v[!v<n]
 [1] 21.73297 35.62573 37.85436 35.55606 32.11441 43.81346 38.94573 
39.86544 22.76372 20.50420 40.54351 30.24666
>>

HTH
Petr


> 
> On Fri, Apr 14, 2006 at 01:24:59AM +0200, Barbora Kocúrová wrote: >
> Hello. > I have a vector which length is n. And I would need to put
> off the item of the vector with index k which is less then n. > Could
> you please advise me? > Thanks > Barbora K. >
> ---------------------------------------- > hry.atlas.cz - Světově
> proslulá karetní hra Poker Texas Hold´em online > >
> ______________________________________________ >
> 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 -- Csardi
> Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list