R - do I need to add explicit new line character with print()?

后端 未结 3 1825
鱼传尺愫
鱼传尺愫 2020-11-30 02:34

How do I use the new line character in R?

myStringVariable <- \"Very Nice ! I like\";

myStringVariabel <- paste(myStringVariable, \"\\n\", sep=\"\");         


        
3条回答
  •  失恋的感觉
    2020-11-30 02:53

    You can also use writeLines.

    > writeLines("hello\nworld")
    hello
    world
    

    And also:

    > writeLines(c("hello","world"))
    hello
    world
    

提交回复
热议问题