0

I am working with R.

My data looks like this..

Name    Value  Stocks
Angel    56      2
John     30      1
Michael  40      3
Mike     25      7
George   37      8
Jake     20      3
Pamela   23      4
Jim      25      4
Jenny    30      3
Eva      28      3

So, I need to create 4 new data frames with only two persons each, and then I got a fifth (5th) with only two names.

I know that I can do this

set.see(1234)
mydat2 <- sample_n(mydat, 2)

However, if want to do this four times I need to execute this every time. Is there a way that I can extract the four data frames at once with just one code execution?

Thanks

Ajrhjnd
  • 179
  • 7

0 Answers0