I want to repeat specific rows of my minority class in my train set. I know, this is not a very fancy way to work like, but I just want to try it out.
Suppose, I have this dataframe:
> df
group type number
1 class1 one 4
2 class1 three 10
3 class1 nine 3
4 class4 seven 9
5 class1 eight 4
6 class1 ten 2
7 class1 two 22
8 class4 eleven 8
Now I want to repeat the row of my minority class (class4) so many times, that I have 50% of class1 and 50% of class4 in a new dataframe.
I know there is the function rep, but I could only find solutions to repeat the whole dataframe.
How can I do this?