# load ATUS data script

# The data requires the IPUMSr package and the I/O needs tidyverse
library(ipumsr)
library(tidyverse)


# load ATUS data
ddi <- read_ipums_ddi("/Users/josh/Google Drive/Teaching/DAT309/Week2/ATUS2/atus_00002.xml")
data <- read_ipums_micro(ddi)

# to write/save the R-data
write_rds(data,"ATUS_data.RDS")

# remove data, to prove this works
rm(data)

# to read data in one step, clean-names the variables and name it df
df <- read_rds("ATUS_data") |> janitor::clean_names()
