There are several ways to execute code in the script editing window. Most of them literally copy the lines with R script to the console window and execute them.
To execute the current line or selection use Ctrl+Enter. The previous command can be rerun using Ctrl+Shift+P.
Tip
Code completion of your code in the editor window will only work if the objects are available in your workspace. Make sure that you execute the assignment of objects in the editor.
Executing a script file line by line is tedious. So RStudio makes it easy to execute (or source) all the lines of a script file with Ctrl+Shift+Enter. This will copy all the lines to the console and execute them. The output of the script is printed in the console windows. Note that RStudio treats the execution of all the lines as one statement.
It is also possible to source the current file without printing statements in the console. This can be done with Ctrl+Shift+S . RStudio makes this even easier with the Source on Save option...