[R] write merged data frame to a file

Andrea Franceschini atariw at gmail.com
Mon Jul 18 17:10:02 CEST 2011

Dear Philipp,

You were right,
thankyou very much.
Effectively the second read.table didn't work (probably because of the
strange characters).
>From my point of view this is a very bad R bug.
I precisely inserted the "\t" separator in the read table command,
hence I would expect that everything is working.
How can I make it work ???
Effectively there are several ' (i.e. apostrophe) characters in the
file. I guess are those that confuse R

Thankyou very much,
Best Regards,

On Mon, Jul 18, 2011 at 4:32 PM, Philipp Pagel <p.pagel at wzw.tum.de> wrote:
> On Mon, Jul 18, 2011 at 04:00:29PM +0200, Andrea Franceschini wrote:
>> I use version 13 of R in OSX (downloaded and installed less than 1 year ago).
> Probably 2.13 ...
> [...] code omitted
>> The first lines are OK (i.e. 14 columns, like the dataframe), while at
>> a certain point I get lines with only 3 columns !!!
>> The bad lines that contain only 3 columns have the name and the
>> description of the gene (i.e. the content of the file that I merged
>> with).
>> Besides, these strange lines also get repeated (see the bottom).
> I havent't carefully analyzed your code so I may be wrong but my guess for
> all "weird behaviour of gene related data.frames" problems is this:
> Gene descriptions love to contain things like "Foo 5' obfuscation
> factor".  Note the "'" in the description which read.table will
> happily interpret as a quotation mark and eat lots of rows until it
> happens to encouter a closing counterpart. This leads to all kinds of
> funny results. So I bet your problem is not in write.table but in
> reading the data. Have a closer look at your data frame: are you
> really getting the expected number of observations in the merged
> data.frame? Are the rows in question really ok in the data frame? If
> my guess is correct you should be able to fix your problem by
> including quote="" in both your read.table commands.
> If it doesn't, also try comment.char="" - another popular source of
> problems.
> cu
>        Philipp
> --
> Dr. Philipp Pagel
> Lehrstuhl für Genomorientierte Bioinformatik
> Technische Universität München
> Wissenschaftszentrum Weihenstephan
> 85350 Freising, Germany
> http://webclu.bio.wzw.tum.de/~pagel/

More information about the R-help mailing list