[R] Wrinting integers in a matrix faile

Oleg Sklyar osklyar at ebi.ac.uk
Fri Feb 23 11:35:02 CET 2007


write.matrix(as.integer(b),'data.out')

Mohsen Jafarikia 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 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')
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466



More information about the R-help mailing list