# How to Enter Commands in RStudio?

## Entering Commands in RStudio –

When you start RStudio the main window on the left is a R Session. From there you can enter commands interactively directly to R.

R prompts you with > (greater than sign). You can type any expression here and R will evaluate for you.

Let’s say you want to add two number 5 and 6 together.

We can see the result is 11. And if you look carefully you can see [1] before it. To R the result is a vector which have only one element int it. R labels the value with [1] to signify that this is the first element of the vector.

R will prompt you for input until you type a complete expression. The expression max(5, 10, 20) is a complete expression so R stops reading input and evaluates what it’s.

> max(5, 10, 20)
[1] 20

In contrast, max(5, 10 is an incomplete expression, so R prompts you for more input. The prompt changes from greater than ( > ) to plus ( + ), letting you know that R expects more.

> max(5, 10,
+ 20)
[1] 20

Rating: 1 out of 5.

Posted in RTagged