From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

message

message

- [Instructor] R provides message. It's a way to create a diagnostic message, and it looks a lot like print, or cat. So, let's take a certain amount of time to find out why you'd want to use message and how it differs from either print or cat. To illustrate, I've created a vector called aLongString, and in it I've placed four string elements, lines from the Jabberwockey poem. Let's do a quick look at what happens when I type in print aLongString. p-r-i-n-t, and then there's aLongString. And when I hit the Run command, you'll see that I get four lines. Twas brilling, Did gyre, All mimsy, and the momes. Now, let's take a look at what cat does. cat(aLongString), and then I hit Run. In the console window now, you could compare the difference between print and cat. Print sends out each element of the vector individually. Cat concatenates each element of the vector. Now, there's a couple of options that we can do with cat,…

Contents