Irina
2010-Jul-05 15:49 UTC
[R] Issue with write.table and read.table : I'm not getting out what I put in
Hello, I am trying to save a large matrix of values in a file. My problem is that I am writing write.table(allpos,'control_chr1.txt', dec=".") and then I want to check it with test2=read.table('control_chr1.txt') sum(test2[,2]==allpos[,2]) This last number is lower than the length of the test2[,2] vector. This is really annoying me because I can't figure out why I don't get out the same thing that I put in.
jim holtman
2010-Jul-05 17:01 UTC
[R] Issue with write.table and read.table : I'm not getting out what I put in
Why not use 'save' & 'load'? On Mon, Jul 5, 2010 at 11:49 AM, Irina <irina.krier at epfl.ch> wrote:> Hello, > > I am trying to save a large matrix of values in a file. My problem is that I am > writing > write.table(allpos,'control_chr1.txt', dec=".") > and then I want to check it with > test2=read.table('control_chr1.txt') > sum(test2[,2]==allpos[,2]) > > This last number is lower than the length of the test2[,2] vector. This is > really annoying me because I can't figure out why I don't get out the same thing > that I put in. > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
David Winsemius
2010-Jul-05 17:30 UTC
[R] Issue with write.table and read.table : I'm not getting out what I put in
On Jul 5, 2010, at 11:49 AM, Irina wrote:> Hello, > > I am trying to save a large matrix of values in a file. My problem > is that I am > writing > write.table(allpos,'control_chr1.txt', dec=".") > and then I want to check it with > test2=read.table('control_chr1.txt') > sum(test2[,2]==allpos[,2]) > > This last number is lower than the length of the test2[,2] vector. > This is > really annoying me because I can't figure out why I don't get out > the same thing > that I put in. >Many potential problems could underly getting FALSE for an "==" test. One might be FAQ 7.31. Another might be encoding or locale issues related to the decimal separator. Why not post a reproducible example? -- David Winsemius, MD West Hartford, CT