commit R function