Dear all,

for the first array I can get ten 2x2matrices (and I am partially happy for
this). Now, I have problem with the 2nd array. It gives three 2x2 matrices
for both rows, while it was "supposed" to give five 2x2 matrices in the
first row and three 2x2 matrices ONLY in the second row. What could I do to
fixthat?
Thank you very much in advance!

All the best,
Loukia

t  = c(  1 ,  2,  2 ) # Interventions

tn<-as.vector(table(t))

add<-vector("list",length(unique(t)))
for(i in 1:length(unique(t))){
for(k in 1:tn[i]){
add[[i]]<-array(1,dim=c(2,2,n[[i]][k],k))
}
}
add

On Fri, Oct 26, 2012 at 10:54 AM, Loukia Spineli
<spineliloukia26@gmail.com>wrote:

> Dear all,
>
> to make our life easier, I give you the following dataset (just this
> vector) and code! It gives me two arrays of different dimensions: the first
> is a 2x2x1 array and the second is a 2x2x2 array (please, feel free to
> correct me on the way I define the arrays. This is the first time I am
> working on them).
>
> What I want to achieve is to create 10 2x2 matrices in the first array, 5
> 2x2 matrices and 3 2x2 matrices in the first and second row, respectively,
> of the second array. Feel free to give any data in the matrices!
>
> All I need is to understand where exactly I have stuck in my code! This is
> a part of my (horribly large) code. Once I realise where my problem is,
> then I would be able to have results! All I need is a small "push" from the
> team!:)
> Again thank you very much for your patience!!!
>
> All the best,
> Loukia
>
> t  = c(  1 ,  2,  2 ) # Interventions
>
> tn<-as.vector(table(t))
>
> results<-vector("list",length(unique(t)))
> for(i in 1:length(unique(t))){
> results[[i]]<-array(dim=c(2,2,tn[i]))
> k<-1
> results[[i]][,,k]
> k<-k+1
> }
> results
>
> On Fri, Oct 26, 2012 at 12:57 AM, Richard M. Heiberger <rmh@temple.edu>wrote:
>
>> You are very lucky.  This question was answered last week in
>> https://stat.ethz.ch/pipermail/r-help/2012-October/326597.html
>>
>> For the future, please read the posting guide referenced below and include
>> an example of your
>> data and the result of the calculation you would like to see.
>>
>> Please use R-help directly and not the nabble interface.
>>
>> On Thu, Oct 25, 2012 at 4:21 PM, pinki751 <raj4technology@gmail.com>
>> wrote:
>>
>> > hello,
>> >     I want to make a two dimensional matrix from the data table.That
>> data
>> > table has three column 1st is userid,2nditemid and 3rd is rating
>> > corresponding to the itemid given by userid.I want to make a m*n matrix
>> in
>> > which 'm' is userid and 'n' to be itemid .That 2D matrix should b filled
>> > with that corresponding rating for that itemid for that userid. please
>> help
>> > me out.
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://r.789695.n4.nabble.com/List-of-multidimensional-arrays-tp4647286p4647458.html
>> > Sent from the R help mailing list archive at Nabble.com.
>> >
>> > ______________________________________________
>> > R-help@r-project.org 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.
>> >
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org 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.
>>
>
>

	[[alternative HTML version deleted]]


