templating scheme for R