Ad space (banner)
๐Ÿ“ŠR Lessons
Lesson 2 / 68

Your first output (print)

This lesson covers the basics of printing in R with print, with the aim of getting a feel for what kind of language R is.

print() displays a value. R is a language built specifically for statistics and data analysis. It was created by statisticians in the 1990s and is now used everywhere from university research to professional data science.

The sample code prints a string with the single line print("Hello, R!"). Notice the [1] that appears in front — that is characteristic of R, and simply means "the first element".

A common early stumble is that unfamiliar [1]. R treats even a single value as a vector of length one, so what you are seeing is just the element number.

In professional work, one of R's great attractions is CRAN, an enormous package repository where almost every statistical method has already been implemented by someone.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run R directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)