I am trying to do an in-place replacement of my df with the following conditions:
- the storm name must match
- the landfall date must be the same year, and the date is formatted as YYYYMMDD
When just checking for individual conditions, I do get the correct behavior with the code below:
orig_county_rows$landfall_date[orig_county_rows$Storm_Name == stormName] <- l_date
and
orig_county_rows$landfall_date[grepl(year, orig_county_rows$date)] <- l_date
However, when I combine them like
orig_county_rows$landfall_date[(orig_county_rows$Storm_Name == stormName) && (grepl(year, orig_county_rows$date))] <- l_date
no rows are updated. Does anyone see what I am doing wrong here? Thanks!