[R] Wrinting integers in a matrix faile
Michael Kubovy
kubovy at virginia.edu
Fri Feb 23 03:47:31 CET 2007
On Feb 22, 2007, at 8:36 PM, Mohsen Jafarikia wrote:
> 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?
>
> 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')
?Round
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
More information about the R-help
mailing list