Displaying 2 results from an estimated 2 matches for "fvs_weight".
Did you mean:
fvs_weighted
2006 Mar 07
2
(newbie) Accessing the pieces of a 'by' object
...I tried the Reshape() package and also the aggregate and reshape
functions. Those don't work too well becuase of the need to pass
weighted.mean a weights vector. I tried the by() function, but now I
don't know how to coerce the returned object into a matrix so that I
can reshape it.
> fvs_weighted.mean <- function(y) weighted.mean(y$F3MRet, y$IndexWeight, na.rm=T);
> tmp_byRet <- by(dfReturns,
list(dfReturns$Quarter,dfReturns$Year,dfReturns$Ranking),
fvs_weighted.mean);
And various other ways to get the tmp_byRet object into a matrix were
tried, eg. unlist(), a loop lik...
2006 Mar 08
0
survival
...I tried the Reshape() package and also the aggregate and reshape
functions. Those don't work too well becuase of the need to pass
weighted.mean a weights vector. I tried the by() function, but now I
don't know how to coerce the returned object into a matrix so that I
can reshape it.
> fvs_weighted.mean <- function(y) weighted.mean(y$F3MRet,
y$IndexWeight, na.rm=T);
> tmp_byRet <- by(dfReturns,
list(dfReturns$Quarter,dfReturns$Year,dfReturns$Ranking),
fvs_weighted.mean);
And various other ways to get the tmp_byRet object into a matrix were
tried, eg. unlist(), a loop lik...