R-matrix theory for collinear chemical reactions