[R] cbind

Tobias Verbeke tobias.verbeke at businessdecision.com
Fri Jun 29 16:05:10 CEST 2007


livia wrote:

> Hi, I have a series of return data, a and b are factors. I would like to
> build a matrix which contains each vector of "returns". I am thinking about
> something as following, but I guess there should be a sensible way of doing
> this. 
> 
> returns <- split(return, list(regimef, assetf))
> cbind(returns[[1]], returns[[2]],...,returns[[n]])

Does

do.call("cbind", returns)

do what you want ?

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business & Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
tobias.verbeke at businessdecision.com



More information about the R-help mailing list