Hi, I hope someone can help me here, I’ve been banging away at this for a day now. I’m using CSV.write() to write a dataframe to a CSV file (.txt). The output opens perfectly in excel, but the layout isn’t right in the text file. I’m doing the following:
CSV.write(“test.txt”,df,writeheader=false,newline=“\n”)
For example, what i get in excel is in columns as expected:
a b c d
e f g h
i j k l
What appears in the text file is:
a,b,c,de,f,g,hi,j,k,l
I want it to appear in the text file as:
a,b,c,d
e,f,g,h
i, j,k,l
when I open it in notepad (I need it in this format).
I’ve tried opening a text file and using append, and I get the same result. I’ve searched all over, and there is lots of info about reading, but very little about writing. The help seems quite sparse too. ‘opts’ is mentioned, but no other information on ‘opts’.
I’m stumped, help appreciated.
Thanks
edit: Added commas to desired text file layout