print()

Published Oct 7, 2022
Contribute to Docs

The print() function prints out the specified argument.

Syntax

print(argument)

The argument to be printed is of a valid data type.

Example

The following example prints out a data frame with the print() function:

school_teams <- data.frame(Sport = c("Basketball", "Baseball", "Football", "Track", "Tennis", "Swim"), Coach = c("Tyler", "Blake", "Stephanie", "Jordan", "Taylor","Brooklyn"), Player_Count = c(15, 24, 22, 20, 12, 29))
print(school_teams)

This outputs the following:

Sport Coach Player_Count
1 Basketball Tyler 15
2 Baseball Blake 24
3 Football Stephanie 22
4 Track Jordan 20
5 Tennis Taylor 12
6 Swim Brooklyn 29

All contributors

Looking to contribute?

Learn R on Codecademy