0

Let's say I have one data frame named MLTXZP that looks like this:

1   0.00038 0.75053 0.50    35  6000    0.75346
2   0.00038 0.75053 0.50    35  6050    0.72079
3   0.00038 0.75053 0.50    35  6100    0.69229
4   0.00038 0.75053 0.50    35  6150    0.66689
5   0.00038 0.75053 0.50    35  6200    0.64382
...
7247    0.00061 0.74996 0.80    105 6800    0.61635

and another data frame named populations that looks like this. Note that the second column is either 0 or 1.

1   1
2   1
3   1
4   1
5   1
...
7247 1

Notice how the first column of both files are the same? I want to create two new data frames that are subsets of MLTXZP. I want one data frame to be MLTXZP but only the rows which have the 0 tag from the second file. I want the other data frame to be MLTXZP but only the rows which have the 1 tag from the second file. Is there a great way to do this?

EDIT: Column names for MLTXZP "model ID", "Z", "X", "M", "L", "T", "non-linear period"

Column names for populations (I may rename this data frame`) "model ID", "population num"

Woj
  • 449
  • 1
  • 5
  • 15
  • Can you provide column names? – cmirian Mar 29 '21 at 16:09
  • `result = split(MLTXZP, populations[2])` will give a `list` with the split data frames in it. You can reference them with `result[["0"]]` and `result[["1"]]` (though it is probably safer to rename them with non-numeric names). – Gregor Thomas Mar 29 '21 at 16:12
  • @cmirian Thomas See edit for column names that I gave them. – Woj Mar 29 '21 at 16:18

0 Answers0