Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A naive implementation of doing some counting after data logic for a list of dates and a given source data frame.
# Generate your list of dates
mydays <- seq.Date( as.Date('2015-01-01'), as.Date('2015-03-09'), by="day")
# Write function to sum the number of open dates that occur in sourceData at least 31 days prior to given date.
numOpenDates <- function( givenDate ){
retValue <- sum( (givenDate - sourceDate$openDate) > 30 )
# Apply function to each date in your list of dates(mydays)
answer <- lapply(X=mydays, FUN=numOpenDates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.