-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter not working in cbs_get_data, on column SoortRegio_2 #33
Comments
Hello, I hope it is OK for another user to reply instead of the package creator? In the vignette there is an example which uses has_substring() to filter. I also think it is better to filter on a dimension column and not a measure column. I think this works: cbs_get_data(id = "84583NED", WijkenEnBuurten = has_substring("GM")) |
CODE in python:
Uitvoering:
|
@datadwerg thx for answering the question: seems indeed the intention of the question. data_all <- cbs_get_data(id = "84583NED")
data_gm <- subset(data_all, grepl("GM", WijkenEnBuurten))
# or using tidyverse
library(tidyverse)
data_gm <- data_all %>% filter(str_detect(WijkenEnBuurten, "GM")) |
Thanks for the responses. The solution by @datadwerg answers my question and works. Kerncijfers wijken en buurten 2020 contains ~17.000 rows and the gemeentes only take 355 of those. So although post-filtering works, it is much slower/requires more resources. |
I am only interested in data from the gemeentes from the 'Kerncijfers wijken en buurten'.
So my code looks like this:
cbs_get_data("84583NED", SoortRegio_2 = "Gemeente ", verbose = T)
(with two spaces after 'gemeente'). This does not seem to work however, all types of regions are loaded. Any idea why?
Could it possibly have something to do with the '_' in the column name?
The text was updated successfully, but these errors were encountered: