0
0
R Programmingprogramming~5 mins

First R program in R Programming - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - First R program
Start R script
Run cat("Hello, world!")
Display output on console
End program
The program starts, runs the cat command to show text, then ends.
Execution Sample
R Programming
cat("Hello, world!")
This code prints the text Hello, world! to the console.
Execution Table
StepActionCode EvaluatedOutput
1Execute cat functioncat("Hello, world!")Hello, world!
2Program endsNo more codeNo output
💡 No more code to run, program ends.
Variable Tracker
VariableStartAfter Step 1Final
No variablesN/AN/AN/A
Key Moments - 2 Insights
Why do we use cat() in R to show text?
cat() tells R to display the text on the screen cleanly, as shown in step 1 of the execution_table.
Does the program store the text in a variable?
No, this simple program just prints text directly without storing it, so variable_tracker shows no variables.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is printed at step 1?
AHello, world!
Bcat("Hello, world!")
CNo output
DProgram ends
💡 Hint
Check the Output column in execution_table row 1.
At which step does the program finish running?
AStep 1
BBefore Step 1
CStep 2
DNever ends
💡 Hint
Look at the Action column in execution_table row 2.
If we remove cat(), what happens to the output?
ANo output is shown
BText still prints
CError occurs
DProgram runs twice
💡 Hint
R evaluates string literals and prints them (with [1] formatting), so text still prints.
Concept Snapshot
cat("text")
- Shows text on the console
- Runs code line by line
- No variables needed
- Program ends after last line
Full Transcript
This simple R program uses cat() to show the text Hello, world! on the screen. The program starts, runs the cat command, then ends. There are no variables used. The output appears on the console after running cat().