
Jesse E. answered 06/03/19
Experienced tutor for TEAS, chemistry, and biology
To do this, use the following code that I used in R:
fun <- 1:60
> fun[1:(i+6) == (i+6)]
[1] 7 14 21 28 35 42 49 56
What this code is telling R to do is to subset the vector, fun, between 1 and (i+6) and only return a value is the value is equal to (i +6).
This subset of the function can be assigned to a vector as follows:
>fun2 <- fun[1:(i+6) == (i+6)]