Works in RStudio IDE but not in RStudio Cloud

Maybe your package versions are not the same in both places (a key aspect for reproducibility).

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

A link to your RStudio Cloud project (with access permissions) would be helpful too.