why don't you use a 'list' as the return value.  The 'cbind' is going to
assume that each of the 'return[[..]]' have the same length or you are going
to get error messages:

> cbind(1:3,4:10)
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6
[4,]    1    7
[5,]    2    8
[6,]    3    9
[7,]    1   10
Warning message:
number of rows of result
        is not a multiple of vector length (arg 1) in: cbind(1, 1:3, 4:10)
>

I would assume a matrix like above is not what you want.  So why don't you
just say:

return(split(return, list(regimef, assetf)))



On 6/29/07, livia <yn19832@msn.com> 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]])
>
> Could anyone give me some advice? Many thanks.
> --
> View this message in context:
> http://www.nabble.com/cbind-tf3999805.html#a11359949
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

