Disclaimer: As a confirmed Mac user since 1984, I know virtually nothing about Ubuntu so will not venture any guesses about your issues installing and updating packages on the PC. To help those familiar with Ubuntu solve your problems, you should be as specific as possible, including all error messages.
For RStudio Cloud, I notice that you have not updated your project's Ubuntu from 16.04.7 to 20.04.2. See the post from April 5 on their What's New page: RStudio Cloud. Perhaps they are not providing compiled package binaries for the older OS.