Tidy up and use Rcpp_IsNA, Rcpp_IsNaN where possible