0
0
R Programmingprogramming~5 mins

First R program in R Programming - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the simplest way to print text in R?
Use the print() function with the text inside quotes, like print("Hello, world!").
Click to reveal answer
beginner
What does the following R code do?<br>
print("Hello, world!")
It shows the text "Hello, world!" on the screen.
Click to reveal answer
beginner
How do you write a comment in R?
Start the line with #. Anything after # is ignored by R.
Click to reveal answer
beginner
What is the purpose of the print() function in R?
It shows information or results on the screen so you can see them.
Click to reveal answer
beginner
Can you run R code directly in the console?
Yes! You can type R commands in the console and press Enter to see results immediately.
Click to reveal answer
Which function prints text in R?
Aecho()
Bdisplay()
Cshow()
Dprint()
What will this code output?<br>
print("Hi there!")
AError
BHi there!
Cprint("Hi there!")
D"Hi there!"
How do you write a comment in R?
A# comment
B// comment
C<!-- comment -->
D/* comment */
What happens if you run print(123) in R?
AIt prints the number 123
BIt prints "123" as text
CIt causes an error
DIt prints nothing
Where can you type R commands to run them immediately?
AIn a text editor
BIn a web browser
CIn the R console
DIn a spreadsheet
Explain how to write and run your first R program that prints a message.
Think about how you tell R to show words on the screen.
You got /3 concepts.
    Describe how comments work in R and why they are useful.
    Comments are notes for people, not for the computer.
    You got /3 concepts.