I have a column (in a dataframe, with each row represent a paper published) called Publisher. It's a factor. I used this code to run a frequency table:

table(data$Publisher) %>%

sort(decreasing=TRUE)

I got a frequency table like this:

BMC

28

PloS

18

Springer Nature

9

Elsevier

5

BMJ

3

(here I omitted many other values with frequency less than 3)

I'm trying to regroup all the publishers with value less than 3 into "Other", because I'm hoping to group those publishers with which not many papers have been published into Other in a pie chart. Otherwise the pie chart would get too crowded and not meaningful. But I'm stuck here with recoding Publisher. Can anybody help?