Search code examples
rtextsave

Write a character vector with some "\n" to a text file, replacing them with line breaks in R?


How to save a character vector containing some \n in a .txt file in R?

char = "Name\nAddress\nAge"

Should I use writeLines?


Solution

  • writeLines(char, "filename.txt")