[R] divid the rows of the matrix by the cector
Dimitris Rizopoulos
d.rizopoulos at erasmusmc.nl
Thu Mar 11 13:47:53 CET 2010
say 'mat' is your matrix and 'vec' is your vector, then try this:
mat / rep(vec, each = m)
I hope it helps.
Best,
Dimitris
On 3/11/2010 1:44 PM, khazaei at ceremade.dauphine.fr wrote:
> Hi,
> I have a matrix with m rows and n column and a vector with n elements. I
> want to divid each rows of the matrix by vector direcly.
> could you please hint me?
>
> Thank you
> khazaei
>
> ______________________________________________
> R-help at r-project.org 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.
>
--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center
Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
More information about the R-help
mailing list