0
0
R Programmingprogramming~10 mins

First R program in R Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
First R program
📖 Scenario: You want to learn how to write your very first program in R. This program will simply store a message and then show it on the screen.
🎯 Goal: Build a simple R program that stores a greeting message in a variable and then prints it.
📋 What You'll Learn
Create a variable called message with the exact text "Hello, R world!"
Create a variable called exclamation_count and set it to 1
Use a paste0() function to add exclamation_count number of exclamation marks to message
Print the final message using print()
💡 Why This Matters
🌍 Real World
Writing simple scripts to display messages is the first step in learning R programming, useful for data analysis reports and automation.
💼 Career
Basic R programming skills are essential for data analysts and scientists to manipulate data and communicate results.
Progress0 / 4 steps
1
Create the message variable
Create a variable called message and set it to the exact string "Hello, R world!".
R Programming
Need a hint?

Use the assignment operator <- to assign the string to message.

2
Add exclamation count variable
Create a variable called exclamation_count and set it to the number 1.
R Programming
Need a hint?

Use the assignment operator <- to assign the number 1 to exclamation_count.

3
Add exclamation marks to the message
Use the paste0() function to add exclamation_count number of exclamation marks to the end of message. Store the result back in message.
R Programming
Need a hint?

Use strrep("!", exclamation_count) to repeat the exclamation mark.

4
Print the final message
Print the variable message using the print() function.
R Programming
Need a hint?

Use print(message) to show the message on the screen.