I have some char and factor variables in my data frame that look like "A ,A " "B ,B ,B ,B " "C ,C "
I am trying to export the whole data frame to a .csv but the output is very erratic. It makes me even more confused because I want European csv format. When I open the csv file, additional columns are being created based on the commas of that variable.
I have tried the following, nothing worked:
write.table(mydata, "C:/Data/test.csv",row.names=FALSE,sep=";",dec=',')
write.table(mydata,"C:/Data/test.csv",row.names=F, quote = TRUE)
write.table(mydata, "C:/Data/test.csv",row.names=FALSE,sep="\t",dec=',')
#This works well, but I would rather have a .csv than an excel file:
write.table(mydata, "C:/Data/test.xls",row.names=FALSE,sep="\t",dec=',')
The expected output is a column where the cells don't split, like so:
VariablesWithCommas
A ,A
B ,B ,B ,B
C ,C
Any help is appreciated