Nevil Amos
2010-May-07 15:18 UTC
[R] writing string values from a matrix to a file without enclosing quotes
I am trying to format data for the Geneland package I need to write a series of paired numbers and paired "000" to a plain ascii file without surrounding the numerals with quotes, the original data is in a matrix formatted paired strings, and written to file using write.table(x,"output filename",col.names=F,row.names=F) thus "77 79" "132 132" "000 000" "179 181" "132 132" "150 150" "179 179" "132 132" "000 000" "179 179" "132 134" "150 152" however I need the output file without the quotes but retaining 000 not reducing it to 0 thus 77 79 132 132 000 000 179 181 132 132 150 150 179 179 132 132 000 000 179 179 132 134 150 152 How might I achieve this? Thanks Nevil Amos
Jorge Ivan Velez
2010-May-07 15:26 UTC
[R] writing string values from a matrix to a file without enclosing quotes
Hi Nevli, Take a look at the "quote" argument under ?write.table. In your case write.table(x, "output filename", col.names = F, row.names = F, quote FALSE) should do what you want. HTH, Jorge On Fri, May 7, 2010 at 11:18 AM, Nevil Amos <> wrote:> I am trying to format data for the Geneland package > I need to write a series of paired numbers and paired "000" > to a plain ascii file without surrounding the numerals with quotes, > the original data is in a matrix formatted paired strings, > and written to file using > write.table(x,"output filename",col.names=F,row.names=F) > thus > "77 79" "132 132" "000 000" > "179 181" "132 132" "150 150" > "179 179" "132 132" "000 000" > "179 179" "132 134" "150 152" > > however I need the output file without the quotes but retaining 000 not > reducing it to 0 > > thus > 77 79 132 132 000 000 > 179 181 132 132 150 150 > 179 179 132 132 000 000 > 179 179 132 134 150 152 > > How might I achieve this? > > Thanks > > Nevil Amos > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Reasonably Related Threads
- Geneland error on unix: Error in MCMC(........ :, unused argument(s) (ploidy = 2, genotypes = geno)
- warning In fun(...) : no DISPLAY variable so Tk is not available
- replacing "+" in string
- How to replace all <NA> values in a data.frame with another ( not 0) value
- How to remove $ (Dollar sign) from string