search for: meannacon

Displaying 1 result from an estimated 1 matches for "meannacon".

2005 Jul 05
1
help eliminating for loops
I am having trouble with apply. Could someone suggest changes to the code below that will eliminate the for loops? R 2.1.1 patched Windows 2k Thanks, John function () { NaCon<-array(dim=c(10,10)) for (i in 1:10) {NaCon[i,]<-rnorm(10,10.77,0.02)} MeanNaCon<-vector(mode="numeric",length=10) for (j in 1:10) {MeanNaCon[j]<-mean(NaCon[j,1:10])} print(MeanNaCon) #assign("MakeNaCon",MakeNaCon) hist(MeanNaCon) } John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryla...