You can run an R program in RStudio in two ways:
1. You can write the line of code in the console. Then, you have to hit ‘Enter’ to run the R code that you have written to get the output in the console itself.
2. Another way is to write the R code using the R script editor. You can write the code and hit ‘Ctrl+Enter’ to run the code. Now, you can see the output in the console window.
If you are looking for an online course to learn R programming, check out this R Programming Course by Intellipaat.