Create Rfunction