My 24 hours of search for what I feel is a trivial (Not for a newbie in R as I am) problem has not yet born fruits. So please help me out. I have a single data frame that I would wish to split into two. Here is how the data looks like;
d1 d2 d3 d4 p1 p2 p3 p4
30 40 20 60 1 3 2 5
20 50 40 30 3 4 1 5
40 20 50 30 2 3 1 4
here is what I want it to look like;
$d
d1 d2 d3 d4
30 40 20 60
20 50 40 30
40 20 50 30
$p
p1 p2 p3 p4
1 3 2 5
3 4 1 5
2 3 1 4
I have tried to most of the commands and examples online but they all seem to be splitting data along rows such as in:
split(1:3, 1:2)
How can I indicate even with the use of indexes that I want to split the first 4 columns from the last four?