[R] Read Unicode text (*.txt)

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Mon Jul 1 23:44:53 CEST 2019


Hi Javad,
Unicode characters do have embedded nulls. Try this:

d4<-read.table("./4.csv",sep=";",header=TRUE,encoding="UTF-8")

Jim

On Tue, Jul 2, 2019 at 3:47 AM javad bayat <j.bayat194 using gmail.com> wrote:
>
> Dear R users;
> I am trying to read an excel CSV file (1.csv). When I read it as csv file
> in R, the R shows me the exact number of row. But it puts all columns in
> one column, while I have 3 or 4 columns in the data frame.
> "
> d4 = read.table("./4.csv",sep=";",header=TRUE)
>      Warning messages:
>      1: In read.table("./4.csv", sep = ";", header = TRUE) :
>       line 1 appears to contain embedded nulls
>      2: In read.table("./4.csv", sep = ";", header = TRUE) :
>      line 2 appears to contain embedded nulls
>      3: In read.table("./4.csv", sep = ";", header = TRUE) :
>      line 3 appears to contain embedded nulls
>      4: In read.table("./4.csv", sep = ";", header = TRUE) :
>      line 4 appears to contain embedded nulls
>      5: In read.table("./4.csv", sep = ";", header = TRUE) :
>     line 5 appears to contain embedded nulls
>      6: In read.table("./4.csv", sep = ";", header = TRUE) :
>     line 1 appears to contain embedded nulls
>      7: In scan(file = file, what = what, sep = sep, quote = quote, dec =
> dec,  :
>        embedded nul(s) found in input
> > attach(d4)
> > dim(d4)
> [1] 1814394       1
> "
> I opened the csv file in excel and I tried to make a new csv (delimited)
> file. I dont know why in the "save as type" box Unicode text (*.txt) is
> written. Why the format is txt while the file extension is .CSV?
> Please help me to read this format correctly.
> Many thanks.
>
>
>
> --
> Best Regards
> Javad Bayat
> M.Sc. Environment Engineering
> Alternative Mail: bayat194 using yahoo.com
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list