missing.type. Snippet from foreign::read.dta() by Thomas Lumley and R-core members. The implementation is half in Rcpp, half in R. Since I do not know how people expect the results and I do not use it myself, I did not try to implement the R part in Rcpp.