[R] Functions on matrix row level
Torsten Hothorn
Torsten.Hothorn at rzmail.uni-erlangen.de
Mon Jan 28 16:35:58 CET 2002
> Hi together,
>
> I have some data in a matrix structure - say 1000 rows with 10 columns. And
> I like to do some calculations (like max, avg or min) on row level.
> The only solution I found so fare was using a loop like
>
> for (i in 1:1000) {
> max[i] <- max(matrix[I,])
> }
this will not work anyway (`I' is unknown) and it is unwise to overwrite
`matrix'.
R> apply(mymatrix, 1, max)
will do,
Torsten
>
> It looks like that this is not very fast.
> Does an other way exists?
>
> Kind regards
>
> Ulrich
>
>
> ---------------------------------------------------------
> This Mail has been checked for Viruses
> Attention: Encrypted mails can NOT be checked!
>
> **
>
> Diese Mail wurde auf Viren geprueft
> Hinweis: Verschluesselte mails koennen NICHT auf Viren geprueft werden!
> ---------------------------------------------------------
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list