Give a predictor its correct R class, and np carries that meaning through the analysis.
With year ordered, cross-validation tunes a discrete Li–Racine kernel;
the fitted values are level-specific, and Delta is an adjacent-level difference.
With year numeric, it tunes a continuous Gaussian kernel and returns an analytic derivative.
Give the variable the right class; np handles the rest.