print()

print()

The print() function will print out, or make visible in the output, any contents in the argument. 

Example 1:

The print() function can be helpful for annotating code output. Put content in "quotations" to avoid error messages.

print("Analysis of Variance")
print("p = 0.02")

Example output:

Output of print function

Example 2:

You can also use the print() function to printout the contents of a data frame.

# print an entire data frame
print(MindsetMatters)

Example of output from running the code above (truncated):

Output of print function with the MindsetMatters data frame

# print a single column (variable) of a data frame
print(MindsetMatters$Age)

Example of output from running the code above:

Output of the print function with the MindsetMatters data frame and the Age variable