R-matrix theory of reactive atom-diatom collisions