bluefoxr / COINr

COINr
https://bluefoxr.github.io/COINr/
Other
22 stars 7 forks source link

Error in write_dset(coin, iData_i, dset = write_to) : Names of columns do not correspond to entries in .$Meta$Ind$iCode in data to write to coin. #32

Closed Petrina95 closed 1 year ago

Petrina95 commented 1 year ago

Hello again!

I have changed the code names of the indicators and the subareas and the new codes happen to have white spaces (in order to have a more readable result) and some special characters (those we could omit). When I am trying to impute the data I get the following error: Error in write_dset(coin, iData_i, dset = write_to) : Names of columns do not correspond to entries in .$Meta$Ind$iCode in data to write to coin.

I have double-checked that the names of the columns of the raw data match the code names of the indicators metadata, so I cannot understand why I get this error. When I removed white spaces the imputation was executed normally.

Am I doing something else wrong?

Thank you in advance, Petrina

bluefoxr commented 1 year ago

Hi, the problem here is that indicator codes are used as column names in data frames and if these contain spaces, this causes problems in R, e.g. when pivoting from long to wide and in many other places. So, basically you can't have spaces in indicator codes, I'd suggest to use underscore or something like that instead.

I've added a catch to stop spaces in indicator codes now (it will now throw an error message).

Petrina95 commented 1 year ago

Hello again!

Thank you once again for your response. Fortunately, I have found a workaround to use these names as an extra column.

Best regards, Petrina