R users typically work in RStudio. This IDE (Integrated Developer Environment) builds on the base R software to offer a more-accessible interface for everything from writing code to installing packages. If someone says they use R, they probably run RStudio as they program in the R language.
In the default RStudio layout, you code and run code in the panes along the left.
Type in the Console and press the Enter key to run code line-by-line. You'll see a continuous log of code you've run followed by each line's output.
When you close R, the Console gets cleared; you'll start fresh next session. This is great if you need to run a line of code once, in the moment--like opening Help (?) to see how a function works.
If you want to run your code in the future, save it in a file. When you open a file, it appears above the Console.
Open or add a file using the File menu.
New File > R Script: Code only
New File > R Markdown: Code and formatted text
New Project: Folder that keeps related files (scripts, data, etc.) together
You can run code directly from an R Script file. Press Ctrl+Enter or Cmd+Enter to run the current line or a selected section.
Running code from the file enters and runs it in the Console. Your script file stays the same.
Depending on its design, your code may print a result in the Console, change your system, or produce other output.
If you create an object (e.g.: dat <- c(1:5)), the object appears in the Environment in the upper right pane. Use any object stored in the Environment by typing its name in your code.
If you open Help or visualize your data, the result appears in the lower right pane.