tags:

views:

43

answers:

1

say, i have a vector which have thousands of elements. whats the R code if i wanna make the element between 100-200 become 0. or, how to count the length between two different value. for example, the share price, if i wanna know the length of time when the price is b/t 30-40. thx a lot

+1  A: 

Please read the 'Introduction to R' manual that came with your installation.

One of your questions is simply

  X[ 100:200 ] <- 0

and the other operations are similar. The essential material, so you need to read up a little.

Dirk Eddelbuettel