The current CRAN version of the package cannot load the full 2011 Census microdata file, or even the example file that comes with the package:
install.packages("MicroDatosEs")
#> package 'MicroDatosEs' successfully unpacked and MD5 sums checked
library(MicroDatosEs)
#> Warning: package 'MicroDatosEs' was built under R version 4.2.2
#> Loading required package: readr
#> Warning: package 'readr' was built under R version 4.2.2
x <- censo2010(system.file("extdata/sampleCenso2010.txt", package = "MicroDatosEs"))
#> Error in if (!tipo %in% c("D", "N", "HHMM")) stop("Column types can only be D (key-value), N (numeric) or HHMM (hour-minute)."): argument is of length zero
The problem is that the new error-checking code does not allow missing variable descriptions. Since the 2011 census microdata is static and the new 2021 census may have a different format of microdata (we'll see when it is published), a quicker fix, for now, would probably be to add those missing variable encodings to metadata files.
The missing variable in question is TDESP, which is not found in censo_2010_mdat2.txt.
The current CRAN version of the package cannot load the full 2011 Census microdata file, or even the example file that comes with the package:
Created on 2023-01-05 with reprex v2.0.2
This is due to the relatively new error-checking code introduced in commit 46e9583ba74ebb79c8c36a2d7bba1c264232efc7.
The problem is that the new error-checking code does not allow missing variable descriptions. Since the 2011 census microdata is static and the new 2021 census may have a different format of microdata (we'll see when it is published), a quicker fix, for now, would probably be to add those missing variable encodings to metadata files.
The missing variable in question is
TDESP
, which is not found in censo_2010_mdat2.txt.