try:

cat(sprintf("%d %d %f %f %f %f\n", b[,1], b[,2], b[,3], b[,4], b[,5],
b[,6]), file='data.out', sep='')



On 2/25/07, Mohsen Jafarikia <[EMAIL PROTECTED]> wrote:
>
> Hello everyone,
>
> I am using the following program to get the p-value of some numbers
> (column 'LR' of the data.dat file). I want to write the 1st and 2nd
> column of the output file (data.out) as an integer while the program
> change them. Could anybody please tell me how I can write
> the code which writes the values of the first two columns as integer?
>
> For your convenience, I have attached the input and output files.
> I should indicate that I have already sent this message but I could not
> apply your comments.
> Thanks
>
> library ('MASS')
> MP<-read.table(file='data.dat')
> names(MP)<-c('B','R','S','L','LR','Q')
> a<-as.matrix((1-pchisq(MP$LR, df=1)))
> b<-cbind(MP$B,MP$R,a,MP$S,MP$L,MP$LR,MP$Q)
> write.matrix(b,'data.out')
>
>
>
> These are the files if you don't like to open the attached file!
>
>
>
> data.dat:
>
> 1   7   1.704094  10.61   0.874286  0.00
>
> 2   7   1.955271   2.82   1.001429  0.00
>
> 3   6   2.960459   3.74   1.548667  0.00
>
> 4   4   6.120956   5.83   3.929000  1.92
>
>
>
> data.out:
>
> c d
>
> 1.000000e+00 7.000000e+00 3.497715e-01 1.704094e+00 1.061000e+01
> 8.742860e-01 0.000000e+00
>
> 2.000000e+00 7.000000e+00 3.169650e-01 1.955271e+00 2.820000e+00
> 1.001429e+00 0.000000e+00
>
> 3.000000e+00 6.000000e+00 2.133323e-01 2.960459e+00 3.740000e+00
> 1.548667e+00 0.000000e+00
>
> 4.000000e+00 4.000000e+00 4.746016e-02 6.120956e+00 5.830000e+00
> 3.929000e+00 1.920000e+00
>
> ______________________________________________
> [email protected] 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 you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

Reply via email to