I have a project where I read a SAS dataset into R and then after some manipulation in R I use the write.table function to create the dataset as a .txt file. My issue is, when I do this new lines are created due to hidden new line characters? in the SAS file.
How the data appears in SAS and in R
THIS IS FAKE DATA
How the data appears in the text file I create when I open it in Notepad++
THIS IS
FAKE DATA
How do I go about preventing this. I suppose I would accept an answer that removes them from the SAS dataset or one that removes it from R or even if there was a way to automatically correct the issue in the notepad++ file.
library(haven)
data<-as.data.frame(read_sas("data.sas7bdat")
write.table(data,"data.txt",header=FALSE,sep="\t", quote=FALSE,row.names=FALSE,col.names=FALSE)