How to shuffle rows in a data frame in R?

data_frame
r

#1

Hello,

I want to shuffle the rows in my data frame and get a permutation from it. I am having around 40k values.
How to do this task in R?

thanks.


#2

Hello @mukesh,

You can use

df[sample(nrow(df), nrow(df), ]

Hope this helps!