ronggui
2005-Nov-21 13:03 UTC
[R] Fw: Re: Is there anything like a write.fwf() or possibility to print adata.frame without rownames?
>Petr Pikal wrote: >> Hi >> >> did you tried something like >> >> write.table( tab, "file.txt", sep="\t", row.names=F) >> >> which writes to tab separated file? >> > >Petr thanks, but I do not want a tab delimited file. I need spaces >between columns.write.table( tab, "file.txt", sep="", row.names=F) Can it do what you want?>> On 21 Nov 2005 at 11:56, Gregor Gorjanc wrote: >> >> Date sent: Mon, 21 Nov 2005 11:56:48 +0100 >> From: Gregor Gorjanc <gregor.gorjanc at bfro.uni-lj.si> >> Organization: University of Ljubljana >> To: r-help at r-project.org >> Subject: [R] Is there anything like a write.fwf() or possibility to print a >> data.frame without rownames? >> Send reply to: gregor.gorjanc at bfro.uni-lj.si >> <mailto:r-help-request at stat.math.ethz.ch?subject=unsubscribe> >> <mailto:r-help-request at stat.math.ethz.ch?subject=subscribe> >> >>>Dear R users, >>> >>>R has read.fwf() function, however I would need write.fwf. I know >>>other write.* functions, but I need fixed width format of data, which >>>I would like to export from R. I tried to use: >>> >>>- write.table, but I can not control alignment of columns >>> >>>- write.matrix from MASS, but columns are to wide >>> >>>I came to this option, which is very neat: >>> >>># tmp is data.frame >>> >>>sink(file = file) >>>print(tmp) >>>sink() >>> >>>This works very nice, but I would like to get rid of rownames, which >>>are always printed. >>> >>>Another not so important issue is width of printed columns. I presume >>>this is determined by max(length column name, max(length of "values" >>>in a column)) but sometimes it would be usefull to control width of >>>columns also. >>> >>>Can someone help me with this issue? >>> > >-- >Lep pozdrav / With regards, > Gregor Gorjanc > >---------------------------------------------------------------------- >University of Ljubljana PhD student >Biotechnical Faculty >Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan >Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si > >SI-1230 Domzale tel: +386 (0)1 72 17 861 >Slovenia, Europe fax: +386 (0)1 72 17 888 > >---------------------------------------------------------------------- >"One must learn by doing the thing; for though you think you know it, > you have no certainty until you try." Sophocles ~ 450 B.C. > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html= = = = = = = = = = = = = = = = = = = = 2005-11-21 ------ Deparment of Sociology Fudan University My new mail addres is ronggui.huang at gmail.com Blog:http://sociology.yculblog.com