Convex Functions In R