Opens an interactive HTML interface to explore Brazilian Census variables and copy codes for use with sus_socio_add_census().
Usage
sus_census_explore(
dataset = "all",
year = 2010,
lang = "pt",
output = "browser",
verbose = TRUE
)Arguments
- dataset
Character string specifying the census dataset. Options:
"all"- All datasets (default)"population"- Population microdata"households"- Household microdata"families"- Family microdata"mortality"- Mortality microdata"emigration"- Emigration microdata"tracts"- Census tract aggregate data
- year
Integer specifying census year. Options:
2010(default) or2000.- lang
Character string specifying language. Options:
"pt"(Portuguese, default),"en"(English),"es"(Spanish).- output
Character string specifying output format. Options:
"browser"- Interactive HTML in web browser (default)"console"- Simple list in R console"codes"- Returns only variable codes as character vector
- verbose
Logical. If
TRUE(default), prints informative messages.
Value
Depending on output:
"browser": Opens HTML interface, returns invisible data.frame"console": Prints summary, returns invisible data.frame"codes": Returns character vector of variable codes
Details
This function helps users discover which census variables are available.
The interactive interface allows easy copying of variable codes for use
in sus_socio_add_census(vars = ...).
Examples
if (FALSE) { # \dontrun{
# Open interactive explorer for all datasets
sus_census_explore()
# Explore only population variables
sus_census_explore(dataset = "population")
# Get variable codes for programmatic use
vars <- sus_census_explore(
dataset = "population",
output = "codes",
lang = "en"
)
# Use in sus_socio_add_census
data <- sus_socio_add_census(
df = my_data,
vars = vars,
dataset = "population",
year = 2010
)
} # }