Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: invalid multibyte string [duplicate]

Tags:

r

I use read.delim(filename) without any parameters to read a tab delimited text file in R.

df = read.delim(file) 

This worked as intended. Now I have a weird error message and I can't make any sense of it:

Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) :  invalid multibyte string at '<fd>' Calls: read.delim -> read.table -> type.convert Execution halted 

Can anybody explain what a multibyte string is? What does fd mean? Are there other ways to read a tab file in R? I have column headers and lines which do not have data for all columns.

like image 284
Martin Preusse Avatar asked Feb 14 '11 15:02

Martin Preusse


1 Answers

I realize this is pretty late, but I had a similar problem and I figured I'd post what worked for me. I used the iconv utility (e.g., "iconv file.pcl -f UTF-8 -t ISO-8859-1 -c"). The "-c" option skips characters that can't be translated.

like image 152
Patrick B. Avatar answered Sep 22 '22 23:09

Patrick B.