Re: [R] write.table: adapt end of line

2016-02-26 Thread Ulrik Stervbo
You could also use kable from the Knitr package Best, Ulrik On Fri, 26 Feb 2016 at 11:17 Uwe Ligges wrote: > writeLines(paste(do.call(paste, c(liste, sep=" & ")), "\\hline"), > con = "empf.csv") > > Best, > Uwe Ligges > > > > On 26.02.2016 11:06, Ferri Leberl wrote: > > > > > > Hi everyone!

Re: [R] write.table: adapt end of line

2016-02-26 Thread Uwe Ligges
writeLines(paste(do.call(paste, c(liste, sep=" & ")), "\\hline"), con = "empf.csv") Best, Uwe Ligges On 26.02.2016 11:06, Ferri Leberl wrote: Hi everyone! I want to include a table into LaTeX. I have a fitting environment and don't want to deal with xtable, so only the core of the ta

Re: [R] write.table with append=T after using cat on same file

2015-07-28 Thread PIKAL Petr
Hi Your example works for me. Error is on your side. Try ?traceback or start with plain R -vanilla or upgrade R. > sessionInfo() R Under development (unstable) (2015-06-15 r68521) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows XP (build 2600) Service Pack 3 locale: [1] LC_COLLA

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread William Dunlap
Missing words: Use 'TRUE' and 'FALSE' instead of 'T' and 'F' >to avoid< this sort of problem Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jul 27, 2015 at 1:50 PM, William Dunlap wrote: > This will happen if you have redefined 'T': > > T <- 101:104 > > write.table(df, file="junk.tx

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread William Dunlap
This will happen if you have redefined 'T': > T <- 101:104 > write.table(df, file="junk.txt", sep=",", append=T, quote=F, row.names=F, col.names=F) Error in file(file, ifelse(append, "a", "w")) : invalid 'open' argument Use 'TRUE' and 'FALSE' instead of 'T' and 'F' this sort of problem. Bil

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread Mark Sharp
I do not get an error with R-3.2.1 on Mac OS. You may have done something prior to this code so that perhaps F is not FALSE or T is not TRUE. R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jul 27, 2015, at 3:32 PM, Waichler, Scott R > wrote: > > Hi, > > For years I've been writing text t

Re: [R] write.table produces a file that read.table can't read

2014-10-08 Thread MacQueen, Don
How about: tmp <- data.frame(a=1:3, b=c("a", "b\"b", "c")) write.table(tmp, './tmp.write', row.names=FALSE, sep="\t², quote=FALSE) tmp.in <- read.table('./tmp.write', sep='\t', head=TRUE, quote="") > all.equal(tmp, tmp.in) [1] TRUE -Don -- Don MacQueen Lawrence Livermore National Labora

Re: [R] write.table and append

2013-02-08 Thread Brian Smith
Ah, I didn't know this! Thanks Ben. On Fri, Feb 8, 2013 at 10:18 AM, Ben Tupper wrote: > Hi, > > On Feb 8, 2013, at 9:40 AM, Brian Smith wrote: > > > Hi, > > > > I am trying to append tables on file with this sample code: > > > >for(i in 1:2){ > >mat <- data.frame(sample(1:30

Re: [R] write.table and append

2013-02-08 Thread Ben Tupper
Hi, On Feb 8, 2013, at 9:40 AM, Brian Smith wrote: > Hi, > > I am trying to append tables on file with this sample code: > >for(i in 1:2){ >mat <- data.frame(sample(1:30,9),3,3) >colnames(mat) <- letters[1:3] >ifelse(i == > 1,write.table(mat,paste('te

Re: [R] write.table and append

2013-02-08 Thread Brian Smith
Thanks Louis! That seems to work! On Fri, Feb 8, 2013 at 10:06 AM, Louis Aslett wrote: > I believe your problem stems from using ifelse() actually ... it > requires the statements which it runs to return a value with the same > shape as the test, which write.table() isn't doing. > > Just change i

Re: [R] write.table and append

2013-02-08 Thread Louis Aslett
I believe your problem stems from using ifelse() actually ... it requires the statements which it runs to return a value with the same shape as the test, which write.table() isn't doing. Just change it to a regular if with an else and you'll be fine: for(i in 1:2){ mat <- data.frame(sample(1:30

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor
Thank you David - you put me into right direction. Back to normal, problem sorted. I've missed a single quote in 'annot' data when I imported it from file using read.table function with the default 'quote' argument. quote="\"" did the trick. Many thanks -Igor On Wed, 2012-09-19 at 14:55 -0700,

Re: [R] write.table: strange output has been produced

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 12:20 PM, Igor Chernukhin wrote: > Hi David - > Thank you for your reply. You are probably right. The last 'normal' line > doesn't have a double quote closed. There is the complete line below: > > -8< > "4657","1599

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor Chernukhin
Hi Jim - Thank you for your reply. -8< > str(annot) 'data.frame': 6895 obs. of 4 variables: $ id : int 231803 231804 231805 231810 231811 231816 231818 177697 223131 231823 ... $ kogdefline : Factor w/ 1898 levels "17

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor Chernukhin
Hi David - Thank you for your reply. You are probably right. The last 'normal' line doesn't have a double quote closed. There is the complete line below: -8< "4657","159998",133.10761487064,185.450704462326,80.7645252789532,0.43550400907

Re: [R] write.table: strange output has been produced

2012-09-19 Thread jim holtman
It would also be helpful if you could provide the output of 'str' for all the objects that you are using. e.g., str(statdata)str(extra) Also in creating your data.frame, use "stringsAsFactors = FALSE": extra = data.frame(kogdefline=rep(NA,n) , kogClass = rep(NA,n) , kogGroup = rep(

Re: [R] write.table: strange output has been produced

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 9:12 AM, Igor wrote: > Good afternoon all - > > While making a steady progress in learning R after Matlab I encountered > a problem which seems to require some extra help to move over. > Basically I want to merge a data from biological statistical dataset > with annotation da

Re: [R] write.table and read.table commands

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 10:04 PM, R. Michael Weylandt > wrote: It's because read.table returns a data frame, not a matrix. You can coerce to a matrix with as.matrix() but you might loose information if your variables are of different classes. Michael On Aug 27, 2012, at 7:07 PM, Cheryl Johns

Re: [R] write.table and read.table commands

2012-08-27 Thread R. Michael Weylandt
It's because read.table returns a data frame, not a matrix. You can coerce to a matrix with as.matrix() but you might loose information if your variables are of different classes. Michael On Aug 27, 2012, at 7:07 PM, Cheryl Johnson wrote: > Greetings, > > When I try to use the write.table c

Re: [R] write.table extra column

2011-08-15 Thread Mike Hunter
Thanks! On Mon, Aug 15, 2011 at 12:55 AM, Jeff Newmiller wrote: > Yup. > > Read ?write.csv and note the row.names argument. > --- > Jeff Newmiller The . . Go Live... > DCN: Basics: ##.#. ##.#. Live Go... > Live: OO#..

Re: [R] write.table extra column

2011-08-15 Thread Jeff Newmiller
Yup. Read ?write.csv and note the row.names argument. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Softw

Re: [R] Write.table Question

2011-08-01 Thread Ivan Calandra
Hi Margaux, Check the row.names and col.names arguments of write.table. See ?write.table write.table (dat, file = "/path/to/my/data.txt", sep = " ", col.names=FALSE, row.names=FALSE) HTH, Ivan Le 8/1/2011 17:18, Margaux Keller a écrit : Hi, I'm trying to create an abbreviated data file fr

Re: [R] write.table vs. read.table and the argument "fill"

2011-05-08 Thread Carl Witthoft
Well, it could be a list variable. foo<- 1:7 bar<-1:9 rab<-list(foo,bar) I suppose I could do something like oof<-rbind(foo,bar) write.table(oof) #ignore the warnings and then ignore or delete the redundant items in the output file. On 5/8/11 1:51 AM, Joshua Wiley wrote: Hi Carl, What wou

Re: [R] write.table vs. read.table and the argument "fill"

2011-05-08 Thread David Winsemius
On May 7, 2011, at 10:38 AM, Carl Witthoft wrote: Just wondering how come read.table lets you specify fill=TRUE for ragged arrays, but so far as I can tell, no equivalent for write.table? I imagine the answer is something along the lines of read.table creates a rectangular structur

Re: [R] write.table vs. read.table and the argument "fill"

2011-05-07 Thread Joshua Wiley
Hi Carl, What would the "equivalent" argument for write.table do? Or perhaps to rephrase my question what type of R object do you have in mind to write that is a "ragged array"? Josh On Sat, May 7, 2011 at 7:38 AM, Carl Witthoft wrote: > Just wondering how come read.table lets you specify fill

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
Great. Thank you, Peter! -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 7:26 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal places On 2011-01-25 17:22, Jim Moon wrote: > Thank you for

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
I am using: "R version 2.11.1 (2010-05-31)" It is good to know that it works in 2.12.1 Jim -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:57 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- mainta

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
0.023 8.808e-01 -0.26 8.641e-02 -0.114 4.520e-01 -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:09 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal places On 2011-01-25 16:16, Jim M

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
ailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:09 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal places On 2011-01-25 16:16, Jim Moon wrote: Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFE

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
0.45200 df.txt: EFFECT2PVALUE 0.023 8.808e-01 -0.26 8.641e-02 -0.114 4.520e-01 -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:09 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal pl

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 16:16, Jim Moon wrote: Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) write.table(format(df, drop0tr

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Sebastian P. Luque
On Tue, 25 Jan 2011 16:16:37 -0800, Jim Moon wrote: > Hello, All, How can I maintain the decimal places when using > write.table()? Have a look at ?format.data.frame -- Seb __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] write.table equivalent for lists?

2011-01-10 Thread William Dunlap
p-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow > Sent: Monday, January 10, 2011 12:59 PM > To: Rainer M Krug; R-help > Subject: Re: [R] write.table equivalent for lists? > > How about dput and dget in the base package? > > --

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Greg Snow
How about dput and dget in the base package? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Rainer M Krug >

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Peter Ehlers
On 2011-01-10 07:34, Rainer M Krug wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/10/2011 04:27 PM, Ivan Calandra wrote: I agree that the R-Core team has better things to do than that, but since it's already there, why not just add it to the base functions? Agree completely - and

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/10/2011 04:27 PM, Ivan Calandra wrote: > I agree that the R-Core team has better things to do than that, but > since it's already there, why not just add it to the base functions? Agree completely - and R.utils is not such an obscure package whi

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Ivan Calandra
I agree that the R-Core team has better things to do than that, but since it's already there, why not just add it to the base functions? Le 1/10/2011 16:19, Peter Ehlers a écrit : On 2011-01-10 06:45, Ivan Calandra wrote: Why isn't it in R base? Good question... I'm definitely not the one able

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Peter Ehlers
On 2011-01-10 06:45, Ivan Calandra wrote: Why isn't it in R base? Good question... I'm definitely not the one able to answer to it! Maybe someone more involved in the development can? Ivan Well, I suspect that Rainer has been on this list long enough to know the answer: Because no has convince

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Ivan Calandra
Why isn't it in R base? Good question... I'm definitely not the one able to answer to it! Maybe someone more involved in the development can? Ivan Le 1/10/2011 15:42, Rainer M Krug a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/10/2011 03:35 PM, Ivan Calandra wrote: Hi, If I u

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/10/2011 03:35 PM, Ivan Calandra wrote: > Hi, > > If I understood you correctly, you can use saveObject()/loadObject() > from package R.utils, like this: Correct - thanks - that is what I was looking for. But why is no such function in R base?

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Ivan Calandra
Hi, If I understood you correctly, you can use saveObject()/loadObject() from package R.utils, like this: library(R.utils) saveObject(x, "x.Rbin") rm(x) y <- loadObject("x.Rbin") HTH, Ivan Le 1/10/2011 15:24, Rainer M Krug a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I am wr

Re: [R] Write.table eol argument

2010-12-21 Thread William Dunlap
At least on Windows, you need to open the file in "binary" mode (as opposed to "text" mode) to prevent the usual OS-dependent way of encoding end-of-line. E.g., > z <- data.frame(x=1:3, y=state.name[1:3]) > f <- file("tmp.csv", open="wb") > write.table(z, file=f, quote=FALSE, sep=";", eol="\

Re: [R] "Write.table" problem

2010-06-15 Thread jim holtman
Do you have comment characters in your data (#)? Are there unbalanced quotes in your data? How may rows does it read in? If you look at the last line read, can you see a problem in your data? These are problems that you will have with your data and try: comment.char='', quotes='' to see what ha

Re: [R] write.table column names shift

2009-09-04 Thread Stefan Grosse
On Fri, 4 Sep 2009 01:07:49 -0700 (PDT) dennis11 wrote: D> It added an index and shifted the column names by one, b is above a, D> and a is above the added index. Try the option row.names=FALSE in write.table then no index is written. Stefan __ R-hel

Re: [R] write.table

2009-02-20 Thread Wacek Kusnierczyk
Rolf Turner wrote: > > On 21/02/2009, at 12:54 AM, lauramorg...@bluewin.ch wrote: > >> Thank you for your advice, but I didn't manage to make it work... >> I tried >> >> carichi.annui <- >> data.frame(anno,loadPTG,loadPO4,loadNT,loadNH4,loadNO3,loadBOD5,loadSiO2) >> >> >> And I got this error messa

Re: [R] write.table

2009-02-20 Thread Rolf Turner
On 21/02/2009, at 12:54 AM, lauramorg...@bluewin.ch wrote: Thank you for your advice, but I didn't manage to make it work... I tried carichi.annui <- data.frame (anno,loadPTG,loadPO4,loadNT,loadNH4,loadNO3,loadBOD5,loadSiO2) And I got this error message: Error in data.frame(anno, loadPTG,

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
Thank you!!! unlist() worked perfectly!!! Have a nice weekend Laura Messaggio originale Da: petr.pi...@precheza.cz Data: 20.02.2009 14.58 A: Copia: Oggetto: Re: [R] write.table Hi r-help-boun...@r-project.org napsal dne 20.02.2009 12:54:41: > Thank you for your advice, but I did

Re: [R] write.table

2009-02-20 Thread Petr PIKAL
vector() could turn a list of numbers into a > vector... was I wrong? > > Messaggio originale > Da: rip...@stats.ox.ac.uk > Data: 20.02.2009 12.40 > A: "lauramorg...@bluewin.ch" > Copia: > Oggetto: Re: [R] write.table > > On Fri, 20 Feb 2009, lau

Re: [R] write.table

2009-02-20 Thread Huang, Guo-Hao
May you put your code and data in the internet? It will be easy for others to find your real problem. - Original Message - From: To: Sent: Friday, February 20, 2009 7:54 PM Subject: Re: [R] write.table Thank you for your advice, but I didn't manage to make it work... I

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
ist" I thought that the function as.vector() could turn a list of numbers into a vector... was I wrong? Messaggio originale Da: rip...@stats.ox.ac.uk Data: 20.02.2009 12.40 A: "lauramorg...@bluewin.ch" Copia: Oggetto: Re: [R] write.table On Fri, 20 Feb 2009, lauramorg.

Re: [R] write.table

2009-02-20 Thread Prof Brian Ripley
On Fri, 20 Feb 2009, lauramorg...@bluewin.ch wrote: Sorry, I'm using R 2.8.1 on Microsoft Windows XP professional 2002 Service Pack 2. The error I get is Error in write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), : 'list' type not implemented in 'EncodeElement

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
Sorry, I'm using R 2.8.1 on Microsoft Windows XP professional 2002 Service Pack 2. The error I get is Error in write.table(x, file, nrow(x), p, rnames, sep, eol, > na, dec, as.integer(quote), : 'list' type not implemented in 'EncodeElement' The problem is that I can' t manage to save the

Re: [R] write.table

2009-02-20 Thread Simon Pickett
Hi Laura, You need to specify where you want to write your table. Like this... write.table(result, file="C:/Documents and Settings/simonp/Desktop/result.csv", sep = ",",row.names = F) If you have to do this alot I think you can set your working drive up to always write table in the same plac

Re: [R] write.table

2009-02-20 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of > lauramorg...@bluewin.ch > Sent: Thursday, February 19, 2009 11:57 PM > To: r-help@r-project.org > Subject: [R] write.table > > Hello, > I tried to turn lists into vectors and

Re: [R] write.table a df with specific column order

2008-06-26 Thread Don MacQueen
Minor correction -- omitted comma. Should be: write.table(t[ , c("a", "b", "c")], row.names=FALSE) Also, using the name "t" should be avoided, because "t" is a built-in function: t() -Don At 8:02 AM -0300 6/26/08, Henrique Dallazuanna wrote: Content-Type: text/plain Content-Disposition:

Re: [R] write.table a df with specific column order

2008-06-26 Thread Henrique Dallazuanna
Try: write.table(t[c("a", "b", "c")], row.names=F) On Thu, Jun 26, 2008 at 6:28 AM, juli pausas <[EMAIL PROTECTED]> wrote: > Hi > I'd like to write.table a dataframe, but with an specific order of > columns. Is there a direct way to do it? or I have to generate a new > dataframe as follows: > >

Re: [R] write.table() error

2008-06-05 Thread Daniel Folkinshteyn
looks like you don't have permission to write a file to C:\ try writing to some other directory where you have write access (e.g., your user's home dir, or your "my documents", or something like that). on 06/05/2008 11:57 PM Megh Dal said the following: Hi, I got following error in write.tab

Re: [R] write.table() error

2008-06-05 Thread Charilaos Skiadas
I just managed to write things just fine, and then I recalled that I had a similar problem when teaching our students SPSS (Yes, I know, don't ask...), but the problem was effectively this: If a given file was open in Excel, then that file was locked and no other program could use it until