Hi,I can see and issue with csv import in R.I have some data files provided to me in csv format. Unfortunately I cannot import them to R. Although when I open them in Excel and import them in Excel format, everything is fine. I know I can convert all files before importing them but I am just curious that that could be.

You are watching: Line 1 appears to contain embedded nulls

this doesn"t work:

data.source.csv but this is fine:

library(readxl)data.source.xls and I"ve got that as a result:

data.frame(stringsAsFactors=FALSE, þÿ.URN. = c("10BE022654416", "10BE022662462", "10BE022001922"), QUESTION = c("Recommendation", "Recommendation", "Choice Dealer"), VERBATIM = c("aaa meer!!!!!", "bbb gesteld", "ccceid"), CONCEPTS = c("-<5|68|180>", "+<7|0|61> -<5|61|106>", "+<7|0|107>") )any thoughts? Maybe that is related to a weird character in the name of the first variable (þÿ.URN)?


andresrcns October 2, 2019, 4:54pm #2

Any chance you can share a link to a sample .csv file that reproduces the issue?


1 Like
jdb March 21, 2021, 1:24am #3

I had this happen to me and the solution was providing the encoding as UTF-16.

Does the following help at all?

data.source.csv
Slavek October 3, 2019, 8:46am #4

*
jdb:
, encoding = "UTF-16"

Thank you but encoding did not help. I still have this error:

Warning messages:1: In read.table(file = file, header = header, sep = sep, quote = quote, : line 1 appears to contain embedded nulls2: In read.table(file = file, header = header, sep = sep, quote = quote, : line 2 appears to contain embedded nulls3: In read.table(file = file, header = header, sep = sep, quote = quote, : line 3 appears to contain embedded nulls4: In read.table(file = file, header = header, sep = sep, quote = quote, : line 4 appears to contain embedded nulls5: In read.table(file = file, header = header, sep = sep, quote = quote, : line 5 appears to contain embedded nullsI don"t know how I could attached the file as only pdfs and pictures are allowed.


Slavek November 19, 2020, 7:28afternoon #5

Ok, I"ve got it in Google Drive: https://drive.google.com/open?id=1U5Psb8CxEBYx74RfquGWLlaN1aJWmJmo


andresrcs November 24, 2020, 9:42afternoon #6

You haven"t made the file public, we don"t have access to it.


Slavek November 24, 2020, 9:48afternoon #7

Ooops, sorry.Try now please: https://drive.google.com/open?id=1U5Psb8CxEBYx74RfquGWLlaN1aJWmJmo


Slavek October 7, 2019, 9:16to be #8

I have a feeling this csv problem is an R issue which can be resolved only by converting csv files to excel prior to importing them to R environment. Unless there is a package helping to import weird or corrupter csv files

*


andresrcns October 8, 2019, 9:40to be #9

Your csv file has a rare encoding that I can"t identify but using "utf16" allows you to read the data, although you lose the special characters like "þÿ"

If you know what the exact encoding is then you can specify it and have the special characters to appear.

See more: Dream League Soccer 2017 Mod Apk, Dream League Soccer 17 Mod Apk Download


1 Like
Slavek October 8, 2019, 9:41to be #10
*
andresrcs:

header = TRUE, fileEncoding = "utf16")

O wow!

*
That was really weird.Thank you!


system closed October 15, 2019, 9:41am #11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.


Home Categories FAQ/Guidelines Terms of Service Privacy Policy

Powered by Discourse, best viewed with JavaScript enabled