r - How do I repeat only a part of a vector? -


I have a vector: 0,24,12,12,12,9, 6, 12, 12, 12, 12 , 12,12 I repeat the last element (12) of only one part of it 96. The first part (0, 24, 12, 12, 12) I want to keep consistency. Can you please help?

The answer depends on whether the number 96 is always located in the 6th position inside you Vector If so, please see the first comment below your question. If the position is variable, however, you can apply a simple query that identifies the position of 96 inside your vector, and then repeat the vector part as many times as you want (2 times in the code below).

  x    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -