add R code for mtp