@@ -47,7 +47,8 @@ rawpaf <- read_csv(infilenm.path,
4747 Locality , Town , Postcode , PrintAddress ,
4848 Multi_occupancy , CouncilArea , UDPRN ,
4949 YCOORD , XCOORD , " 2011Datazone" , LACode ,
50- UPRN , CouncilTaxBand )) %> %
50+ UPRN , CouncilTaxBand ),
51+ show_col_types = FALSE ) %> %
5152 clean_names_modified() %> %
5253 mutate(datazone = substr(x2011datazone , 1 , 9 ),
5354 udprn = as.numeric(udprn ))
@@ -233,8 +234,14 @@ residential <- shes.strata %>%
233234 shes_y2 = ifelse(shes_set == " B" , 1 , 0 ),
234235 shes_y3 = ifelse(shes_set == " C" , 1 , 0 ),
235236 shes_y4 = ifelse(shes_set == " D" , 1 , 0 )) %> %
236- right_join(dz_info ) %> %
237- right_join(residential )
237+ right_join(dz_info ,
238+ by = join_by(dz11 ),
239+ suffix = c(' .x' , ' ' )) %> %
240+ select(- contains(' .x' )) %> %
241+ right_join(residential ,
242+ by = join_by(dz11 ),
243+ suffix = c(' .x' , ' ' )) %> %
244+ select(- contains(' .x' ))
238245nrow(residential )
239246
240247# Remove observations with infrequent la_scode, la_code and la combination
@@ -246,7 +253,10 @@ pafaux <- residential %>%
246253
247254# Merge residential with pafaux
248255paf_check <- residential %> %
249- left_join(pafaux )
256+ left_join(pafaux ,
257+ by = join_by(la_code ),
258+ suffix = c(' ' , ' .y' )) %> %
259+ select(- contains(' .y' ))
250260nrow(paf_check )
251261
252262# Harmonise la and la_code variables
0 commit comments