I want to create a function which finds components of a vector which increase continually by k-times.
That is, if the contrived function is f(x,k)
and x=c(2,3,4,3,5,6,5,7)
, then
the value of f(x,1)
is 2,3,3,5,5
since only these components of x
increase by 1 time.
In addition, if k=2
, then the value of f(x,2)
is 2,3
since only these components increase continually by 2 times.(2→3→4 and 3→5→6)
I guess that I ought to use repetitive syntax like for
for this purpose.