Note that from the helpfile you can read (See ?"|"
):
For |, & and xor a logical or raw vector... and...For ||, && and isTRUE, a length-one logical vector.
Therefore you may want to change your ||
to |
and I think which
is not required here.
subset_df <- df[ df$year < '1972' | df$year > '1982',]