Added two-sided testing for the R version of the test