title: How to shift rows down based on value in column R?
body: <p>I have a data frame that looks kind of like this...but much larger</p>
  <p><a href="https://i.stack.imgur.com/7ZPO5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7ZPO5.png" alt="enter image description here" /></a></p>
  <p>I want to look at the record_id column and shift the right side columns down when the row says admin_time. Then make that previous row NA. Then when I write it to a csv, I'll just use the na = &quot;&quot; to make those cells blank</p>
  <p>For example, in the first few rows, it would look like this...</p>
  <p><a href="https://i.stack.imgur.com/JeAA4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JeAA4.png" alt="enter image description here" /></a></p>
  <p>No need to try to recreate the data frame. I was thinking maybe a for loop would work with an embedded if statement to review the patient_id, record_id, and pk_day. I was just looking for alternate suggestions or how to use a statement within the loop to pick out the admin line and do what I mentioned above</p>