RStudio running really slowly (on Windows 10)

I'm trying to create a workflow in R to do RNA-sequencing analysis. My RStudio is basically unusable- when I open my script and start running the code, it works fine for a few minutes, but then it freezes and starts taking minutes to execute my commands. I've tried uninstalling and re-installing RStudio several times, still the same problem. What could be causing this and how could I fix it?

Do you have similar issues when working on other scripts/projects ?

Yes, when I try to work on code for an R course this happens too.

What operating system do you use ?
Does your Rstudio/R session show high resource usage in a taskmanager equivalent ?

My computer is Windows 10 Pro, I get CPU 0.8% and memory 1210 MB (17% used) when it gets stuck on an R script

Actually, CPU output gets above 10% when I work with large datasets