Executing Basic Functions in the R Console

Let's now try and execute the sum() and sqrt() functions in R. Follow the steps given below:

  1. Open the R console on your system.
  2. Type the code as follows:
sum(1, 2, 3, 4, 5)sqrt(144)
  1. Execute the code.

Output: The preceding code provides the following output:

Functions such as sum() and sqrt() are called base functions, which are built into R. This means that they come pre-installed when R is downloaded.

We could build all of our code right in the R console, but eventually, we might want to see our files, a list of everything in our global environment, and more, so instead, we'll use RStudio. Close ...

Get R Programming Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.