I feel like I'm super close to getting this right, however, it not coming out as planned. Here is my current code:
weather$Date2 <- ifelse(substr(weather$Date, 1, 10) == "2007", "2007-12-01", "2007-12-30")
"Weather" is my dataset, Date is a column with dates, and I am trying to pull the December dates. However, the only result this gives me is:
2007-12 366
I am unsure why ifelse(substr()) aren't pulling out the December dates. Does anyone have an idea of what I am doing wrong here?
Aucun commentaire:
Enregistrer un commentaire