R learner here. I'm trying to use R to compare dates and apply a value based on when the date falls between.
For example, if Acq_Dt is prior to 10-1-1984, Cap_Threshold should be 1000, if it's between October 1 1984 and September 30, 1991, it should be 5000, etc. However, the expression is not working; everything is being evaluated to 5000. Any help would be appreciated.
temp1$Acq_Dt <-as.Date(temp1$Acq_Dt,format="%m/%d/%Y") 
temp1$CapThreshold <- if (temp1$Acq_Dt < "1984-10-01") {         
   1000
  } else if (temp1$Acq_Dt >= "1984-10-01" & temp1$Acq_Dt <= "1991-09-30")  {
   5000
  } else if (temp1$Acq_Dt >= "1991-10-01" & temp1$Acq_Dt <= "1993-09-30") {
   15000
  } else if (temp1$Acq_Dt >= "1993-10-01" & temp1$Acq_Dt <= "1994-09-30")  {
    25000
  } else if (temp1$Acq_Dt >= "1994-10-01" & temp1$Acq_Dt <= "1995-09-30") {
    50000
  } else if (temp1$Acq_Dt >= "1995-10-01" & temp1$Acq_Dt <= "2013-09-30") {
    100000
  } else if (temp1$Acq_Dt >= "2013-10-01") {
    1000000
} else { 
  0
}
 
     
    