I am trying to translate SAS
code below:
data year5 year10;
set loans;
if ID in ("ELC", "OEC") then output year5;
else output year10;
run;
How can I do this in R
so that if a value is in one set of values, it will output to one dataframe
, but if it's not it will output to another?
More specifically, there are three data frames I'm working with. The original data frame, which contains the column 'ID'. If Column 'ID' has the value "ELC" or "OEC" in it, then those rows from the Original data frame will be outputted to the new dataframe Year5, else (there is another value in that 'ID' column) those rows (from Original dataframe) will be outputted to the new dataframe year10. I already have empty dataframes created for Year5 and Year10.