Re: [R] Problem with writing a CSV file in UTF-8 formate

From: Duncan Murdoch <>
Date: Tue, 22 Jun 2010 09:32:03 -0400

On 22/06/2010 9:00 AM, venkata kirankumar wrote:
> Hi all,
> I have a problem with writing a *.CSV file in UTF-8 formate
> I tried to write a dataframe named "dfPREINDX" to the new file named
> "preindx.csv" in below formate
> write.table(dfPREINDX,PreIndex,fileEncoding="UTF-8",sep="|",row.names=FALSE)
> but its throed an error like
> Error in write.table(dfPREINDX, "preindx.csv", fileEncoding = "UTF-8", sep =
> "|", :
> unused argument(s) (fileEncoding = "UTF-8")
> can any one please help me how to create a file in UTF-8 formate.

The write.table has no fileEncoding argument. To write to a non-native encoding, you need to open a connection with that encoding, and write to that. For example:

con <- file("preindx.csv", open="w", encoding="UTF-8") write.table(dfPREINDX, con, sep="|",row.names=FALSE) close(con)

Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Jun 2010 - 13:34:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jun 2010 - 14:50:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive