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 iam 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? please help me on the same.