From the error message it seems you are trying to apply the filter()
function to an object other than a data frame, you might want to double check the class of the object you are working with.
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.