5

When using the print function to print to the screen, I would like one line to appear on one line, and the next line to be on a second line.

with this line

print( 
    paste( 
        "hey I want this to be line one", "and this to be line two", "would be great if you could help"
    )
)

I want this to print

[1] "hey I want this to be line one

[2] and this to be line two would be great if you could help"

MatthewR
  • 2,399
  • 3
  • 20
  • 29

1 Answers1

18

I assume your sample output should actually be three lines instead of two... You should use cat instead of print, and add sep="\n" to the paste statement:

 cat(paste("hey I want this to be line one", 
           "and this to be line two", 
           "would be great if you could help" ,sep="\n"))

Output:

hey I want this to be line one
and this to be line two
would be great if you could help
beroe
  • 10,382
  • 4
  • 29
  • 69