Variational Calculation of R Matrices. Application to Ar Photoabsorption