Load in the OBR’s household disposable income data (sheet 1.13). Split the period data into separate year and quarter variables, ensure that all variable names follow Tidyverse’s style guide. Name this object disposable_income.
Solution
Using the same approach as the housing market sheet, load the range of cells containing the data required, not including the variable names. Add variable names manually after selecting the variables required, then split the time variable into years and quarters.
Load the OBR’s national living wage data (sheet 1.14).
Solution
Using the same approach as earlier, load the correct sheet in, selecting cells with data included. Variable names cannot begin with numbers, so rename them either manually, or by adding a prefix. The rename_with function allows us to rename variables by applying a function to them, in this case paste0 which combines elements in the function separated by commas:
living_wage <-read_xlsx("data/Detailed_forecast_tables_Economy_March_2024.xlsx",# Specify the sheet and range of cells to keepsheet ="1.14", range =c("C4:K5")) %>%# Rename variables by pasting the prefix "year_" to the original namerename_with(~paste0("year_", .x))