I have a simple data.frame that I would like to write to an output .txt file using R.
Sample code:
my_df <- data.frame(name = c("Wendy", "Quinn"), age = c(23, 43))
write.table(my_df, file = "my_output_file.txt", sep = " ", col.names = F, row.names = F, quote = F, eol = "\n")
The trouble is that I am getting the following output file when viewed in Notepad++ (see screenshot). I understand the eol = "\n" argument places a carriage return at the end of each line -- I want that for the line separation between these two rows, but not at the end of the document. Is there a method to omit the final carriage return that results in my .txt file being 3 lines long instead of only 2?