I am trying to use a for loop to extract dates from an SQL query in R. Currently I have:
StartDate<-"2017-07-01"
EndDate<- "2017-07-05"
dates<-seq(as.POSIXct(StartDate, format="%Y-%m-%d"), as.POSIXct(EndDate, format="%Y-%m-%d"), by='days')
for (f in dates){
.
. Code here that is inside for loop
.
}
My issue is that does not come out in a date format as in Dates. How do I get f in the same format as StartDate and EndDate?