I think you mean base R, not base RStudio, they are not the same thing, because if your are actually limited to tools produced by RStudio then you would be fine using dplyr package since it is developed by RStudio people.
Anyways, if you need specific help with this, then you would have to provide a minimal REPRoducible EXample (reprex) illustrating your issue. A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ: