Printing data in R is pretty straight forward. In this article, we will show you two functions that are built in to R that will print data to the console
For those of you who are here to copy the code, here it is. Read on for more details.
print("Printing a string") print(2) cat("Let's print", 2, "or more values")
As shown above, we have two options. The first is the
print("a string") print(2) print(c(1, 2, 3, 4, 5))
However, the print statement can only print one variable at a time. If we want to print multiple, we can use the
cat("a string", 2, c(1, 2, 3, 4, 5))