Asher Meir wrote on 12/30/2011 03:45:48 AM:
> Yes this is the solution to my problem.
>
> I think there is a small typo in old.index, instead of:
>
> k=rep(1:nks, rep(njs*nks, nks)))
>
> it should be:
> k=rep(1:nks, rep(nis*njs, nks)))
> That is, the "k" index should be repli
Yes this is the solution to my problem.
I think there is a small typo in old.index, instead of:
k=rep(1:nks, rep(njs*nks, nks)))
it should be:
k=rep(1:nks, rep(nis*njs, nks)))
That is, the "k" index should be replicated by nis*njs,, not nks*njs.
Many thanks
Asher
On Fri, Dec 3
Asher Meir wrote on 12/29/2011 04:47:21 PM:
> Hello Jean.
>
> Thank you for your prompt response.
>
> I have an economic model. I start out with a list of asset levels
> 1:nks. For every asset level, a person has nis possible income
> levels and njs possible expense levels, with probabilities
Asher Meir wrote on 12/29/2011 02:58:00 PM:
> I want to create a new array which selects values from an original array
> based on a function of the indices. That is:
>
> I want to create a new matrix Vnew[i,j,k]=Vold[i,j,ks] where ks is a
> function of the index elements i,j,k. I want to do this
rg] On Behalf Of Asher Meir
> Sent: Thursday, December 29, 2011 1:58 PM
> To: r-help@r-project.org
> Subject: [R] Array element is function of its position in the array
>
> I want to create a new array which selects values from an original
> array
> based on a function of the in
I want to create a new array which selects values from an original array
based on a function of the indices. That is:
I want to create a new matrix Vnew[i,j,k]=Vold[i,j,ks] where ks is a
function of the index elements i,j,k. I want to do this WITHOUT a loop.
Call the function "ksfunction", and th
6 matches
Mail list logo