Error with my txt

Hello everybody, I'm new in this community and I'm a french student learning Rstudio for Ecological statistics.

I want to do a presence/absence analysis, so I just created a txt file with my datas. My file has a 1st column with the number of the site, a 2nd, 3rd, 4th, 5th and 6th with the name of the species, and in these column I just added "0" for absence and "1" for presence.

The problem is here :
When I enter the code I have an error and I totally don't understand what is wrong there.
Can someone help me please?
Thank you very much!

Code :
data<-read.table("pa_data.txt",h=T, dec=";")

Error :
Warning messages:
1: In read.table("pa_table.txt", h = T, dec = ";") :
line 1 appears to contain embedded nulls
2: In read.table("pa_table.txt", h = T, dec = ";") :
line 2 appears to contain embedded nulls
3: In read.table("pa_table.txt", h = T, dec = ";") :
line 3 appears to contain embedded nulls
4: In read.table("pa_table.txt", h = T, dec = ";") :
line 4 appears to contain embedded nulls
5: In read.table("pa_table.txt", h = T, dec = ";") :
line 5 appears to contain embedded nulls
6: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
embedded nul(s) found in input

I think this is typically a problem with the encoding of the file. There is a fileEncoding argument in read.table so you can write things like

data<-read.table("pa_data.txt",h=T, dec=";", fileEncoding = "utf16")

To know just what value to give to fileEncoding, we have to know how the file was saved. What program made the txt file? If you open it with that program and the use the Save As process, is there a way to choose the encoding?

Thank you for your answer!
I made a table on Excel and saved it on txt. So I don't know how to change the encoding...

I really don't know what happened. I just copied the same table in another excel file and made it again. Now it works ^^
Thank you very much for your help :slight_smile: See you soon I think haha

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