[R] Wrinting integers in a matrix faile

Mohsen Jafarikia jafarikia at gmail.com
Fri Feb 23 02:36:03 CET 2007


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 to double. Could anybody please tell me how I can write
the code which writes the values of the first two columns as integer?
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')



More information about the R-help mailing list