The R-index is a sound methodology, which has been introduced, developed, and used in the sensory and consumer fields for several decades. The R-index methodology can be used both to measure and to test sensory difference and consumer preference. This paper provides an R code for calculation of the R-index critical value for difference testing, which is a supplement to or an alternative for the published table in Bi & O'Mahony (2007) (Journal of Sensory Studies, 22, 713-720). Practical applications The R code provided in the short contributions overcomes the limitation of the previously published table of R-index critical values in Bi & O'Mahony (2007) (Journal of Sensory Studies, 22, 713-720) with its limited number of sample sizes and required equal size for the control sample and test sample.