Re: [R] A problem on sink() and format,suggestions appreciated

From: luan_sheng <luan_sheng_at_yahoo.com>
Date: Wed 01 Jun 2005 - 16:07:26 EST

Yong Wang 写道:

> Dear R users
> I get a weired problem when use sink:
> since the data set pretty big, I sink intermediate result for further
> use,following
> lines are consistently used when write data
>
> ###########################
> sink("dataname.txt")
> data
> sink()
> ##########################
>
> at first couples of run, all 10 variables are wrote to a file in
> following format:
>
>
> V1 V2 ....... V10
> 1 10457 132356.7 ....... 4356.8
> 2 75690.2 66697 ....... 98777
> . ..................................
> 10000 654786 3412.54 ...... 98712.567
>
>
>
> then I did modifcations somewhere else, the format change to:
>
> V1 V2 ....... V9
> 1 10457 132356.7 ....... 7823.569
> 2 75690.2 66697 ....... 77024
> . ..................................
> 10000 654786 3412.54 ...... 336721
>
> V10
> 1 4356.8
> 2 98777
> . .......
> 10000 98712.567
>
> this format is not convenient to read.
> can you hint me where the problem is and how can I make it back to the
> first format?
> I worked on this hours but still can not figure out.
>
> any suggestions highly appreciated!
>
> thank you
>
> yong
>
> ______________________________________________
> R-help@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
>
I dont' know the method you write data into your file.But if you use "write" function ,then you can specify the colums by the "ncolumns". The following is the usage "write"

write(x, file = "data", ncolumns = if(is.character(x)) 1 else 5, append = FALSE)


ŻG䣭йһʼɧų



R-help@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 Received on Wed Jun 01 16:12:15 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:17 EST