[R] Coercing elements of a matrix from integer to double

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Sep 4 23:28:46 CEST 2006


"Thaden, John J" <ThadenJohnJ at uams.edu> writes:

> Ive been converting elements of matrices and arrays, e.g.,  from
> Integers to double-precision, by vectorizing the matrix and then
> remaking it. Alternatively, I can redefine one element as double 
> which then redefines them all.  Both methods are quick, so I guess
> I shouldn't complain, but I would have thought there'd be something
> more obvious. Have I missed it?

storage.mode(M) <- "double"


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list