as.yearmon2 function

Conditionally convert x to yearmon if the conversion is unique, retaining x as names.