control cases in R rather than in Fortran