I have a dataset with two columns(character) - text, source , I want to create a dataset such that if a particular value in text column is present less than 5 times. I am using below code but it is giving only first occurrence instead I need all the observations which satisfies that condition. For example: 'iphone' is present for 4 times in text , so I need all the 4 observations and their corresponding source but I am getting only one observation for that.
test = sqldf('select * , count(*) as count from base group by text having count < 5')
I am familiar with proc sql
in SAS and I have recently started learning R. Does sqldf
works in a different way?