开发者

Change elements of a vector

开发者 https://www.devze.com 2022-12-26 12:17 出处:网络
Say I have a vector which has thousands of elements. What开发者_开发问答 is the R code necessary if I want to make the elements at indices between 100-200 become 0?

Say I have a vector which has thousands of elements. What开发者_开发问答 is the R code necessary if I want to make the elements at indices between 100-200 become 0?

Additionally how would I count the length between two different values, for example if I want to know the length of time when the 'share price' is between 30-40?


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. This is essential material, so you need to read up a little.

0

精彩评论

暂无评论...
验证码 换一张
取 消