Why does 'for' convert dates to numeric and what's the best way to loop through dates?
mnths <- c(as.Date("2016-02-01"),as.Date("2016-03-01"))
str(mnths[1])
Date[1:1], format: "2016-02-01"
for (m in mnths) {
str(m)
}
num 16832
num 16861
Why does 'for' convert dates to numeric and what's the best way to loop through dates?
mnths <- c(as.Date("2016-02-01"),as.Date("2016-03-01"))
str(mnths[1])
Date[1:1], format: "2016-02-01"
for (m in mnths) {
str(m)
}
num 16832
num 16861