# Do not implement these lines in real analysis:
# Use functions `scf_download()` and `scf_load()`
td <- tempdir()
src <- system.file("extdata", "scf2022_mock_raw.rds", package = "scf")
file.copy(src, file.path(td, "scf2022.rds"), overwrite = TRUE)
scf2022 <- scf_load(2022, data_directory = td)
# Example for real analysis: Construct scf_mi_survey object
obj <- scf_design(
design = scf2022$mi_design,
year = 2022,
n_households = attr(scf2022, "n_households")
)
class(obj)
length(obj$mi_design)
# Do not implement these lines in real analysis: Cleanup for package check
unlink("scf2022.rds", force = TRUE)
Run the code above in your browser using DataLab