And how to read a file with a BOM is actually discussed in detail in the 'R Data Import/Export' manual of 2.12.2 RC.

What should be ASCII files with BOMs seem to be cropping up rather frequently these days: the recent culprits are Mac applications with origins on Windows (SPSS was one, some version of Excel another).

On Tue, 22 Feb 2011, John Edwards wrote:

Thanks for all the people that replied my message. The text file indeed has
"\uFEFF". I have fixed the text file by using 'gvim -b'.

On Tue, Feb 22, 2011 at 10:03 AM, Jeff Newmiller
<jdnew...@dcn.davis.ca.us>wrote:

What you describe could be a bug (in which case providing your OS and R
version info per the posting guidelines would be a minimum requirement to
get it fixed) or a control character that is actually in your file (which
you might need a binary editor to see).
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

John Edwards <jhnedwards...@gmail.com> wrote:

Hi,

I have the following input file.
$ cat main.txt
CEL_A CELL_B
1 4
2 5
2 6

Then I run read.table in R.

f=read.table('main.txt', header=T, check.names=F, sep='\t')
head(f)
  \ufeffCEL_A CELL_B
1    1      4
2    2      5
3    2      6
f$CEL_A
NULL

I'm not sure where the special character \ufeff comes from. Could anybody let 
me know what is the problem?

Thanks,
John

        [[alternative HTML version deleted]]
------------------------------
R-help@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code.



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to