[R] [FORGED] IF LOOOP

Rolf Turner r.turner at auckland.ac.nz
Wed Jun 14 01:10:58 CEST 2017


On 14/06/17 08:46, matthias worni wrote:
> Hey
> 
> This should be a rather simple quesiton for some of you. I want to make
> some progress in looping...
> I have the vector r, which contains single values --> see below:
> 
> r
>    [1] 1.1717118 1.1605215 1.1522907 1.1422830 1.1065277 1.1165451 1.1163768
> 1.1048872 1.0848836 1.0627211
>   [11] 1.0300964 1.0296879 1.0308194 1.0518188 1.0657229 1.0685514 1.0914881
> 1.1042577 1.1039351 1.0880163
> 
> 
> I would like to take out simply the value "0.990956" from the vector,
> printing out the rest of it.  The code is from the internet but does not
> seem to work for my vector. Can't figure out why... Thanks for the help
> 
> r <- as.vector(lw)
> count=0
> for (i in r)  {
>    if(i == 0.990956) {
>      break
>    }
>      print(i)
>    }

FAQ 7.31

cheers,

Rolf Turner


-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list