Add the fileEncoding = "UTF-16"
argument to the read call. For a human explanation of why this is going on I recommend [1]. For a more R-related take, try [2]. For reference, I downloaded your file and used the "file" command line program typically available on Linux (and possibly MacOSX) which will tell you about what encoding is used in a particular file. [1] https://www.youtube.com/watch?v=4mRxIgu9R70 [2] https://kevinushey.github.io/blog/2018/02/21/string-encoding-and-r/ On September 7, 2024 12:56:36 PM PDT, Christofer Bogaso <bogaso.christo...@gmail.com> wrote: >Hi, > >I am trying to the data from >https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt >without any success. Below is the error I am getting: > >> read.delim('https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt') > >Error in make.names(col.names, unique = TRUE) : > > invalid multibyte string at '<ff><fe>t' > >In addition: Warning messages: > >1: In read.table(file = file, header = header, sep = sep, quote = quote, : > > line 1 appears to contain embedded nulls > >2: In read.table(file = file, header = header, sep = sep, quote = quote, : > > line 2 appears to contain embedded nulls > >3: In read.table(file = file, header = header, sep = sep, quote = quote, : > > line 3 appears to contain embedded nulls > >4: In read.table(file = file, header = header, sep = sep, quote = quote, : > > line 4 appears to contain embedded nulls > >5: In read.table(file = file, header = header, sep = sep, quote = quote, : > > line 5 appears to contain embedded nulls > >Is there any way to read this data directly onto R? > >Thanks for your time > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide https://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.