The problem I have is as explained in the title. I want to randomize the top, middle and bottom 3 rows in place. Here is a sample dataframe. 

```
> set.seed(7)
> mydf
   Id Name Score Feedback
1  1   AB    11        P
2  2   AA    12        P
3  3   AC    12        P
4  4   AD    31        P
5  5   AE    13        P
6  6   AF    15        P
7  7   AG     9        F
8  8   AH     8        F
9  9   AI    11        P

```

I could take the top, middle and last 3 rows independently and do a randomization and merge them back as follows: 

```
# Take conservative 3 rows from mydf 
  top3 <- head(mydf,3)
  middle3 <- mydf[4:6,]
  tail3 <- tail(mydf,3)
# randomize the rows 
  top3r <- top3[sample(nrow(top3)),]
  middle3r <- middle3[sample(nrow(middle3)),]
  tail3r <- tail3[sample(nrow(tail3)),]
# merge them back 
  mydfr <- rbind(top3r, middle3r, tail3r)
> mydfr
   Id Name Score Feedback
2  2   AA    12        P
1  1   AB    11        P
3  3   AC    12        P
6  6   AF    15        P
4  4   AD    31        P
5  5   AE    13        P
7  7   AG     9        F
8  8   AH     8        F
9  9   AI    11        P

```

Is there someway I could achieve the same without going through the manual process of pulling the n rows? 

Thank you,