Displaying 2 results from an estimated 2 matches for "rowaverag".
Did you mean:
rowaverage
2006 Jul 07
1
computational speed question
I have a 250 row by 20,000 column dataframe called temp and
I do
rowaverage<-function(x) rowmeans(temp[x],na.rm=TRUE )
averages<-tapply(seq(temp),names(temp),rowaverage)
averages<-do.call('cbind',averages)
, is it okay that it's been running for 4 hours or
does this mean that something went wrong. I am on windows
XP and i did ctrl alt delete and it s...
2006 Jul 06
2
tapply question
...en the resulting data frame would be exactly the same except
that the AAA column would be
6 comes from (11 + 1)/2
7 comes from (12 + 2)/2
3 stays 3 because the element in the other AAA is zero
so i don't want to average that one. it shoulsd just stay 3.
So, I do
DF[DF == 0]<-NA
rowaverage<-function(x) x[rowMeans(forecastDf[x],na.rm=TRUE)
revisedDF<-tapply(seq(DF),names(DF),rowmeans)
there are two problems with this :
1) i need to go through the rows of the same name, not the columns
so i don't think seq(DF) is right because that goes through
the columns but i want to g...