Tamas Papp <[EMAIL PROTECTED]> writes:

> Dear list,
> 
> I'd like to use the function cut() on matrices, ie that when I apply
> it to a matrix, it would return a matrix of the same dimensions
> instead of a vector.
> 
> I wonder if there is a better (more elegant) solution than
> 
> matrix(cut(a, ...), ncol=ncol(a), nrow=nrow(a))
> 
> because I would like to use cut on both vectors and matrices and avoid
> testing whether a is a matrix.

Will this not work?:

ac <- cut(a)
dim(ac) <- dim(a)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to