Let I have such a data frame(df);
col1 col2 col3 col4 col5 col6
12 15 21 19 45 43
37 77 90 4 0 51
Namely;
df<-data.frame(col1=c(12,37),col2=c(15,77),col3=c(21,90),col4=c(19,4),col5=c(45,0),col6=c(43,51))
I want to split df into groups and compose a list with these groups. For example, let split df into 2 equal parts
df1:
col1 col2 col3
12 15 21
37 77 90
df2:
col4 col5 col6
19 45 43
4 0 51
And compose a list:
List[1]:
df1
List[2]:
df2
The main aim is to compose the list. However, the number of splitted data frames can change. How can I do this with R? I will be very glad with any help. Thanks a lot.