klarsen1 / MarketMatching

Other
131 stars 37 forks source link

Moved date assignment above filtering. #2

Closed christophertull closed 8 years ago

christophertull commented 8 years ago

When Skip==TRUE for all rows, thendplyr::filter(distances, Skip==FALSE)returns an empty dataframe. This caused the assignment

distances$MatchingStartDate <- min(dates)

to throw the following error:

Error in `$<-.data.frame`(`*tmp*`, "MatchingStartDate", value = Inf) : 
  replacement has 1 row, data has 0

Moving the date assignment above the filtering line should avoid this error.

christophertull commented 8 years ago

I was so eager to submit my first pull request I should have tested some first ;)