3

In this example, I would like to put a line break between "Episode IV" and "A New Hope" but \n isn't working... how can I do it?

library("ReporteRs")
deck <- pptx( title = "Star Wars Movies")  
deck <- addSlide( deck, slide.layout = "Title and Content" )
deck <- addTitle( deck, "Episode IV\nA New Hope")
# spoiler alert
deck <- addParagraph(deck, paste("This movie is about Luke Skywalker, Han Solo,",
                                 "Obi-Wan Kenobi, and some droids who rescue",
                                 "Princess Leia and blow up the Death Star.") )
writeDoc(deck, file = "temp.pptx" )

enter image description here

C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134

1 Answers1

4

Use \r\n instead of \n only

library("ReporteRs")
deck <- pptx( title = "Star Wars Movies")  
deck <- addSlide( deck, slide.layout = "Title and Content" )
deck <- addTitle( deck, "Episode IV\r\nA New Hope")
# spoiler alert
deck <- addParagraph(deck, paste("This movie is about Luke Skywalker, Han Solo,",
                                 "Obi-Wan Kenobi, and some droids who rescue",
                                 "Princess Leia and blow up the Death Star.") )
writeDoc(deck, file = "temp.pptx" )
Sinh Nguyen
  • 4,277
  • 3
  • 18
  • 26
  • 2
    Good old Microsoft. Forgot I was writing to a powerpoint, not a text file. `\r\n` it is. See [here](http://stackoverflow.com/a/1761086/2573061) for the difference. Thanks. – C8H10N4O2 Apr 08 '16 at 18:40