I have a variable term which includes loan term and has only two types: "36 months" and "60 months". I want to filter my dataset df and create two different subsets for these categories.
I have tried using the commands subset, filter,which etc but it didn't work.
codes that I have tried df1 –> df[which(df$term == "36 months"),]
, df1 –> filter(df, term == "36 months")
df1–>df[df$term %in% c("36 months"), ]
and other ways but always choices zero rows.
head(loan_data$term)
[1] " 36 months" " 60 months" " 36 months" " 36 months" " 60 months" " 36 months"
Any suggestion?
Thanks