πŸŽ“ A1Learner
πŸ”
0 of 40 lessons completed

R Introduction

R is a programming language made for working with data. Even a two line script can do real work with data.

Print a line of text

This line prints one piece of text. The text appears in the output with quotes.

print("Data tells a story")

Print a calculation

This line prints the result of a multiplication. The answer 100 appears in the output.

print(25 * 4)

Print text and a number

The first line prints a label. The second line prints a multiplication result.

print("Team score")
print(7 * 6)

Example

print("Daily sales report")
print(150 + 50)

Key points

  • R is used for statistics and careful work with data.
  • R works with tables of data and builds summaries.
  • An R script is a plain text file.
  • This course uses base R with no add-ons.
  • print() sends a value to the output.

In this example the first line prints a title for the report. The second line adds two numbers and prints the total.

Try it Yourself

Edit the code, then press Run.

Running is simulated Β· rdrr.io R Snippets

Exercise

What is R mainly made for?