[R] (kein Betreff)

Sundar Dorai-Raj sundar.dorai-raj at PDF.COM
Wed Mar 31 20:05:21 CEST 2004



Mag. Ferri Leberl wrote:
> Dear colleagues!
> 
> How can I calculate the mean of every line of "feld" without using the command 
> "for"?
> 
> Thank You in advance
> 
> 
> feld<-array(,c(100,10))
> mittel<-array(,c(100,1))
> feld[,]<-rnorm(1000)
> for(a in 1:100){mittel[a]<-mean(feld[a,])}
> 

(please use an informative subject)

See ?rowMeans

mittel <- rowMeans(feld)

-sd




More information about the R-help mailing list