How to group or classify values in a column in R?

How to group or classify values in a column in R.

The target variable loan_status has a few values as can be seen in the picture.

enter image description here

I would like to classify loans with the following loan_status values as being in default (bad, or 1):

  • Charged Off
  • Default
  • Late (31–120 days)
  • Does not meet the creditpolicy. Status:Charged Off

All the other values will be classified as good (or 0).

How to do it in R?

%d bloggers like this: