You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dt<-sp_get_table("budget-central", 2017) dt %>% sp_add_codelist("finmisto")
returns:
"Error: Something went wrong with matching the codelist to the data for period 2017-01-31.
Please inspect the dates on the codelist to make sure there are no duplicate items valid for one given date.
You may want to filter/edit the codelist manually and pass it to the add_codelist function as an object."
I had to rename the column and specify it in the function finm<-sp_get_codelist("finmisto") finm<-rename(finm, "finmisto" = "finmisto_id") dt2<- dt %>% sp_add_codelist(finm, by = "finmisto")
Maybe it would be beneficial to change the colname in finmisto in "sp_get_codelist" function? (Unless it is used elsewhere)
The text was updated successfully, but these errors were encountered:
For this particular codelist, sp_add_codelist() actually joins on the ico column, which does not identify codelist rows uniquely, hence the error message.
For this particular codelist, you probably do want to join the _id and non-_id column, which can be done more concisely like so:
(The by parameter is passed on to left_join() as is, so can be specified in the same way.)
But I found another genuine bug which might affect this, which is already fixed on Github - so just go ahead and use the Github version for now.
petrbouchal
changed the title
sp_add_codelist for "finmisto" requires preprocessing of the codelist
Handle _id columns in codelists for smoother use in sp_add_codelist()Jun 14, 2021
dt<-sp_get_table("budget-central", 2017)
dt %>% sp_add_codelist("finmisto")
returns:
"Error: Something went wrong with matching the codelist to the data for period 2017-01-31.
Please inspect the dates on the codelist to make sure there are no duplicate items valid for one given date.
You may want to filter/edit the codelist manually and pass it to the add_codelist function as an object."
I had to rename the column and specify it in the function
finm<-sp_get_codelist("finmisto")
finm<-rename(finm, "finmisto" = "finmisto_id")
dt2<- dt %>% sp_add_codelist(finm, by = "finmisto")
Maybe it would be beneficial to change the colname in finmisto in "sp_get_codelist" function? (Unless it is used elsewhere)
The text was updated successfully, but these errors were encountered: