Open dmurdoch opened 11 months ago
I've taken a closer look, and I see this in the metadata file being read here:
"Cube Title","Product Id","CANSIM Id",URL,"Cube Notes","Archive Status",Frequency,"Start Reference Period","End Reference Period","Total number of dimensions"
"Consumer Price Index, monthly, seasonally adjusted","18100006","326-0022","https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000601",1;2;3;4;6;7;10,"CURRENT - a cube available to the public and that is current","Monthly","1992-01-01","2023-11-01","2",
"Dimension ID","Dimension name","Dimension Notes","Dimension Definitions"
"1","Geography",,""
"2","Products and product groups",10,""
followed by more lines defining other things. I think there are two issues here that cause the warning:
statcan_data
function only uses the first two lines at this point, and shouldn't be reading the rest of the file. This can be fixed by setting n_max = 1
in the read_csv
call.read_csv
sees it as 11 fields.Problem 2 is harder to deal with. The User Guide https://www.statcan.gc.ca/en/developers/csv/user-guide is unclear about whether this is normal or an error at StatCan. It says there are two kinds of metadata: non-census cubes and census cubes, with different numbers of fields (10 vs 12), so reading exactly 10 fields would mess up census cubes.
When I download the CPI table, I get a warning about a parsing issue:
Created on 2024-01-01 with reprex v2.0.2
The message from
vroom
"callproblems()
on your data frame for details," doesn't work, because the details have been removed by the time the dataset is returned, and I don't see a way to follow the advice to "Specify the column types or setshow_col_types = FALSE
to quiet this message.".