I'm using a conditional to filter based on a string my data frame.
Here, when source is "all", sources are not filtered as expected:
This are my original sources:
> unique(my_data$sources)
[1] "directo" "criteo" "adwords" "organico"
[5] "redes sociales" "email" "referencias" "onesignal"
[9] "adsense"
However if I do filter based on some source, for example "directo", I'm not getting "directo" as the only source in my data frame but 
> unique(data_a$sources)
[1] "criteo" "onesignal"
What would you recommend to me to change in order to achieve what I need?
source <- 'directo'
if(source == 'all') {
data_a <- my_data
} else {
data_a <- my_data %>%
filter(sources == as.character(source))
}
UPDATE 1:
I've discovered that if I groupe by only the necessary columns it filters correctly. I little bit weird. I was hoping to upload the file directly, but cannot do that. I'll put it in Google Drive and share it.
Thank you.