@@ -690,15 +690,54 @@ Age_pension_deeming_rates_by_Date <-
690690 . [, type : = gsub(" _" , " " , gsub(" threshold_" , " " , type , fixed = TRUE ))] %> %
691691 . [, .(Date , type , threshold , deeming_rate_below , deeming_rate_above )]
692692
693+ .aus_pop_by_age_yearqtr <-
694+ rsdmx :: readSDMX(paste0(" http://stat.data.abs.gov.au/restsdmx/sdmx.ashx/GetData/ERP_QUARTERLY/1.0.3.0" ,
695+ paste0(c(" " , 1 : 100 ), collapse = " +" ),
696+ " .Q/all?startTime=1981-Q3" )) %> %
697+ as.data.frame %> %
698+ as.data.table
699+
700+ if (" AGE" %in% names(.aus_pop_by_age_yearqtr )) {
701+ setnames(.aus_pop_by_age_yearqtr , " AGE" , " Age" )
702+ }
703+
704+ if (nrow(.aus_pop_by_age_yearqtr ) > 14e3L ) {
705+ fwrite(drop_constant_cols(.aus_pop_by_age_yearqtr ),
706+ file = " ./data-raw/Estim-Resi-Pop-by-age-1981-present.csv" )
707+ }
708+
709+ .aus_pop_by_yearqtr <-
710+ rsdmx :: readSDMX(" http://stat.data.abs.gov.au/restsdmx/sdmx.ashx/GetData/ERP_QUARTERLY/1.0.3.TT.Q/all?startTime=1981-Q3&endTime=2017-Q3" ) %> %
711+ as.data.frame %> %
712+ as.data.table
713+
714+
715+
716+ if (nrow(.aus_pop_by_yearqtr ) > 145 ) {
717+ fwrite(drop_constant_cols(.aus_pop_by_yearqtr ),
718+ file = " ./data-raw/Estim-Res-Pop-1981-present.tsv" ,
719+ sep = " \t " )
720+ }
721+
722+ austres_reshaped <-
723+ data.table(obsTime = paste0(floor(1971 + seq_along(austres ) / 4 ),
724+ " -Q" , 1 + seq_along(austres ) %% 4 ),
725+ obsValue = as.integer(1000 * as.numeric(austres ))) %> %
726+ . [obsTime < " 1981-Q3" ]
727+
693728aus_pop_by_yearqtr <-
694- fread(" ./data-raw/Estim-Res-Pop-1981-2017.tsv" )
729+ rbind(austres_reshaped ,
730+ fread(" ./data-raw/Estim-Res-Pop-1981-present.tsv" )) %> %
731+ setkey(obsTime )
695732
696733aust_pop_by_age_yearqtr <-
697- fread(" ./data-raw/Estim-Resi-Pop-by-age-1981-2016.csv" ,
698- select = c(" Age" , " Time" , " Value" )) %> %
734+ fread(" ./data-raw/Estim-Resi-Pop-by-age-1981-present.csv" ) %> %
735+ . [, Q : = as.integer(substr(obsTime , 7 , 7 ))] %> %
736+ . [, Y : = substr(obsTime , 0 , 4 )] %> %
737+ . [, date_char : = paste0(" 01-" , month.name [(Q )* 3 ], " -" , Y )] %> %
699738 . [, .(Age ,
700- Date = as.Date(paste0( " 01- " , Time ), format = " %d-%b-%y " ),
701- Value )] %> %
739+ Date = as.Date(date_char , format = " %d-%B-%Y " ),
740+ Value = obsValue )] %> %
702741 setkey(Age , Date )
703742
704743download.file(" http://www.ausstats.abs.gov.au/ausstats/meisubs.nsf/LatestTimeSeries/5206001_key_aggregates/$FILE/5206001_key_aggregates.xls" ,
0 commit comments