Skip to content
Justice Tech School

R Output and Formatting

cat prints text without quotes, print shows R values, sprintf formats numbers and format controls digits and widths.

Example
cat("Total:", 3 + 4, "\n")
print(sprintf("%.2f", 3.14159))
print(format(1234567.891, big.mark = ",", nsmall = 2))

Exercise

Format with decimals.

("%.1f", 2.55)

Quiz Test

Which prints without quotes?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.