I am working on exporting a data.frame to a csv for use in an ecommerce system after I have done some analysis on it.
I am removing the NA values before the extract as they are not allowed in the system I am adding the data to. The process I have looks like this, my data.frame is called prod_out:
prod_out[is.na(prod_out)] <- c("")
prod_con<-file('product_output.csv',encoding="utf8")
write.csv(prod_out,file=prod_con,append=FALSE,eol="\r",quote=TRUE,row.names=FALSE)
This generates the file, however, for the fields that are NULL they are all double quoted like this:
...,"",...
I need to not have the double quotes for NULL fields and leave them for any character field like this:
...,,...
I did change quote=FALSE, however that removed all double quoting and I need the character fields to remain intact. Is there any way to unquote the NULL values?
Any help is appreciated.
Thanks,
Jason