Search code examples
rtidyverse

Write out file using ASCII separators?


I'm trying to recreate an existing C# process in R. I've got it mostly done but I'm getting hung up on one step: the current process saves the output in text files using ASCII unit and record separators, for example:

enter image description here

I know how to write out data frames, but the ASCII separators are a new twist for me. Is there a way to do this using write_lines or a similar function? Thanks!


Solution

  • It looks like there are unit separators between fields and record separators between records. You can create such output by specifying the characters with their hex literal values. For example

    write.table(iris, "iris.txt", sep="\x1f", eol="\x1e")