I'm trying to create a loop for start and end date to run this function:
startdates <- c("2003-10-01", "2004-10-01", "2005-10-01", "2006-10-01", "2007-10-01",
"2008-10-01", "2009-10-01",
"2010-10-01", "2011-10-01", "2012-10-01", "2013-10-01", "2014-10-01", "2015-10-01",
"2016-10-01","2017-10-01", "2018-10-01", "2019-10-01")
enddates <- c("2004-09-30", "2005-09-30", "2006-09-30", "2007-09-30", "2008-09-30",
"2009-09-30","2010-09-30", "2011-09-30", "2012-09-30", "2013-09-30", "2014-09-30",
"2015-09-30", "2016-09-30","2017-09-30", "2018-09-30", "2019-09-30", "2020-09-30")
for(i in dates) {
statsOutput <- FUNCTIONHERE(siteNumber = "xxx",
startDate = startdates,
endDate = enddates)
}
I'm not sure how to set up this loop so that it will take the start date and end date in my vectors (startdates and enddates). I can't list the function I'm using, but it takes a siteNumber, goes into the web to grab data for that site and then uses the startDate and endDate to know which date range to grab.