Update cv.R

use dfmax=P/2 as a condition of termination