Companies House Charts (Day 1 of 5)

My exploratory data analysis of Companies House data in July 2020:

Change in 'Mortgages.NumMortOutstanding' for top cities (ranked by the number of companies changing)



Next, the limitations:

  • The regularity of updating Mortgages.NumMortOutstanding isn't consistent across companies

  • Company status wasn't accounted for

  • The town field is not always completed correctly


And the code snippet:

data %>% 
#for each company AND month of return, get change
group_by(CompanyNumber) %>%
arrange(path_ym,.by_group = TRUE) %>%
mutate(
    Mortgages.NumMortOutstanding_prev = lag(Mortgages.NumMortOutstanding,n=1)
) %>%
ungroup() %>%
filter(!is.na(Mortgages.NumMortOutstanding_prev)) %>%
#get diff
mutate(
    Mortgages.NumMortOutstanding_change = Mortgages.NumMortOutstanding - Mortgages.NumMortOutstanding_prev
) %>%
select(path_ym,CompanyNumber,RegAddress.PostTown,Returns.LastMadeUpDate_ymd,Mortgages.NumMortOutstanding_change)