1
ID_REF           GSM133971          GSM133972               GSM133973
244901_at   5.95461158752441E+001   1.88836498260498E+001   1.98215045928955E+001
244902_at   7.25400314331055E+001   2.65250205993652E+001   1.95321922302246E+001
244903_at   2.23291015625000E+002   1.78133636474609E+002   5.38166885375977E+001
244904_at   3.65505447387695E+001   3.04016351699829E+000   6.80462265014648E+000
244905_at   4.07523269653320E+001   2.58869285583496E+001   1.18088026046753E+001
244906_at   1.50184860229492E+002   5.39840278625488E+001   4.14917945861816E+001
244907_at   2.65190029144287E+001   1.39808797836304E+000   2.08662915229797E+000
244908_at   3.50156021118164E+000   1.05003893375397E+000   4.57657009363174E-001
244909_at   1.02663551330566E+002   1.42618169784546E+001   1.61735534667969E+001
244910_s_at 7.20161895751953E+001   1.57578134536743E+001   1.31729679107666E+001
244911_at   3.26349411010742E+001   7.23858451843262E+000   6.47778940200806E+000

The above is the MAS5.0 normalized data and I need to read the data in R but getthe following error:

 mydat=read.csv("trans.csv",header=T)
 Error in make.names(col.names, unique = TRUE) :invalid multibyte string at '<ff><fe>I'
Stacey John
  • 151
  • 3
  • 3
  • 13
  • 1
    What's the file encoding? Perhabs you can just pass ist to read.table()... Or try iconv http://www.gnu.org/savannah-checkouts/gnu/libiconv/documentation/libiconv-1.13/iconv.1.html – EDi Oct 23 '12 at 12:51
  • 1
    Die you try `read.table("trans.csv", , encoding = "UTF-8")`? – EDi Oct 23 '12 at 13:29
  • I'm going to surmise is the 0 width nonbreaking space character. It looks like it's right at the beginning. Not exactly a programmatic solution, but try backspacing a few times through the first character of the first field and resaving. – Matthew Plourde Oct 23 '12 at 14:11
  • 1
    I managed to resolve the problem by : Go to File -> Save As and save the CSV file as an ODF Spreadsheet (in the 'Save as Type' drop-down). Go to File -> Save As again and save the ODF file as a CSV again (Text CSV). If you are prompted to Keep Current Format or Save in ODF Format, elect to Keep Current Format. You will now be prompted to choose the character set, so choose UTF-8 from the drop-down. The newly saved CSV file will now have a UTF-8 encoding, with all the special characters converted properly. – Stacey John Oct 24 '12 at 07:59

1 Answers1

3

Try the following (According to R: invalid multibyte string)

tbl <- read.delim("dir/file.txt", fileEncoding="UCS-2LE")
Community
  • 1
  • 1
Ali
  • 9,440
  • 12
  • 62
  • 92