Get the next row of a dataframe in r programming : I am working on a r programming project..

I have a dataframe (df) with about 790 observations in. I am trying to extract certain rows from the dataframe. The only simularity with the row i am trying to extract with the row above, which are all named S_NAME:


<LI>1 cat </li>
<li>2 hat </li>
<li>3 S_NAME </li>
<li>4 tin </li>
<li>5 sin </li>
<li>6 S_NAME </li>
<li>7 foo </li>
<li>8 sin </li>
<li>9 S_NAME </li>
<li>10 tinn </li>

So for example, I would want to extract row 4,7 and 10 which all follow S_NAME

I am unsure of how to do this, any help will be great thanks. I know i have tagged python, although that code might help me understand.
Thanks

