List of multidimensional arrays

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
ML
Reply | Threaded
Open this post in threaded view
|

List of multidimensional arrays

ML
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Richard M. Heiberger
I am looking at your pdf file.

it doesn't match your description.

There are no missing values in the vectors
x, y, t.
Each vector has length 55 which is not a multiple of 4,
so we don't know where the 2x2 matrices come from.

The code doesn't run.  There are are too many "}".
PDF files are formatted and are not ascii.

Please send your code in ascii text in the body of the email.
Please pick it up from your email and paste it into
a fresh R session to be sure that it works.

Perhaps consrtruct manually an example of what you want the answer to look
like.

Rich



On Wed, Oct 24, 2012 at 3:51 AM, Loukia Spineli
<[hidden email]>wrote:

> Dear all,
>
> I am trying to create a list, where each list element is a vector of
> different length arrays that contain 2by2 matrices. To be more specific
> there are 11 treatments that are compared with placebo (we have 11
> comparisons) and each comparison is studied by a different number of trials
> and each trial has a different number of missing participants in both arms.
> The length of the list is equal to the number of comparisons. In each
> comparison the number of arrays is equal to the number of trials that study
> this comparison. For instance 4 trials compare PAR with placebo. So, for
> this comparison we have 4 arrays and each array has a length equal to the
> producy of the number of participants in each arm. These arrays contain 2x2
> matrices.
>
> I have attached a document with the data and the code. I cannot create the
> list results the way I have described above. It creates only the  matrices
> for the first array (that has length equal to 135) of the first comparison
> leaving the rest 10 comparisons "NULL".
> Any suggestion would be  really helpful
>
> Thank you in advance,
> Loukia
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
ML
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

ML
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Berend Hasselman

You were asked to provide R code in ascii text.
Also use dput to get the objects into a mail.

Nobody is going to make the effort to copy from your pdf. I certainly will not.

Berend

On 25-10-2012, at 13:45, Loukia Spineli wrote:

> x and y are the frequencies of missing participants in the intervention and
> the control treatment respectively! vector t contains the code of the
> interventions (we have 11 interventions). I re-attach the PDF with some
> small modifications. I am trying to create a list, where each list element
> is a vector of different length arrays that contain 2by2 matrices. To be
> more specific there are 11 treatments that are compared with placebo (we
> have 11 comparisons) and each comparison is studied by a different number
> of trials and each trial has a different number of missing participants in
> both arms. The length of the list is equal to the number of comparisons. In
> each comparison the number of arrays is equal to the number of trials that
> study this comparison. For instance 4 trials compare PAR with placebo. So,
> for this comparison we have 4 arrays and each array has a length equal to
> the producy of the number of participants in each arm. These arrays contain
> 2x2 matrices.
>
> I have attached a document with the data and the code. I cannot create the
> list results the way I have described above. It creates only the  matrices
> for the first array (that has length equal to 135) of the first comparison
> leaving the rest 10 comparisons "NULL".
>
> On Wed, Oct 24, 2012 at 5:17 PM, Richard M. Heiberger <[hidden email]>wrote:
>
>> I am looking at your pdf file.
>>
>> it doesn't match your description.
>>
>> There are no missing values in the vectors
>> x, y, t.
>> Each vector has length 55 which is not a multiple of 4,
>> so we don't know where the 2x2 matrices come from.
>>
>> The code doesn't run.  There are are too many "}".
>> PDF files are formatted and are not ascii.
>>
>> Please send your code in ascii text in the body of the email.
>> Please pick it up from your email and paste it into
>> a fresh R session to be sure that it works.
>>
>> Perhaps consrtruct manually an example of what you want the answer to look
>> like.
>>
>> Rich
>>
>>
>>
>> On Wed, Oct 24, 2012 at 3:51 AM, Loukia Spineli <[hidden email]
>>> wrote:
>>
>>> Dear all,
>>>
>>> I am trying to create a list, where each list element is a vector of
>>> different length arrays that contain 2by2 matrices. To be more specific
>>> there are 11 treatments that are compared with placebo (we have 11
>>> comparisons) and each comparison is studied by a different number of
>>> trials
>>> and each trial has a different number of missing participants in both
>>> arms.
>>> The length of the list is equal to the number of comparisons. In each
>>> comparison the number of arrays is equal to the number of trials that
>>> study
>>> this comparison. For instance 4 trials compare PAR with placebo. So, for
>>> this comparison we have 4 arrays and each array has a length equal to the
>>> producy of the number of participants in each arm. These arrays contain
>>> 2x2
>>> matrices.
>>>
>>> I have attached a document with the data and the code. I cannot create the
>>> list results the way I have described above. It creates only the  matrices
>>> for the first array (that has length equal to 135) of the first comparison
>>> leaving the rest 10 comparisons "NULL".
>>> Any suggestion would be  really helpful
>>>
>>> Thank you in advance,
>>> Loukia
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>>
>>>
>>
> <List of multidimensional arrays.pdf>______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Berend Hasselman
Loukia,

Please send your replies to the R-help list. I am CC'ing this to the R-help list.

On 25-10-2012, at 15:30, Loukia Spineli wrote:

> Dear Berend,
>
> I am not familiar at all with ascii text. If you could suggest me a good link to learn about it, then it would be really helpful!

If that is so, then how are you making your R code or R script?
You must be using a plain text editor but we don't know your version of R, your OS, or anything else.
If you are only using an R console you should look in the documentation of your system to find out how to work with plain text.

Berend

> Best wishes,
> Loukia
>
> On Thu, Oct 25, 2012 at 4:23 PM, Berend Hasselman <[hidden email]> wrote:
>
> You were asked to provide R code in ascii text.
> Also use dput to get the objects into a mail.
>
> Nobody is going to make the effort to copy from your pdf. I certainly will not.
>
> Berend
>
> On 25-10-2012, at 13:45, Loukia Spineli wrote:
>
> > x and y are the frequencies of missing participants in the intervention and
> > the control treatment respectively! vector t contains the code of the
> > interventions (we have 11 interventions). I re-attach the PDF with some
> > small modifications. I am trying to create a list, where each list element
> > is a vector of different length arrays that contain 2by2 matrices. To be
> > more specific there are 11 treatments that are compared with placebo (we
> > have 11 comparisons) and each comparison is studied by a different number
> > of trials and each trial has a different number of missing participants in
> > both arms. The length of the list is equal to the number of comparisons. In
> > each comparison the number of arrays is equal to the number of trials that
> > study this comparison. For instance 4 trials compare PAR with placebo. So,
> > for this comparison we have 4 arrays and each array has a length equal to
> > the producy of the number of participants in each arm. These arrays contain
> > 2x2 matrices.
> >
> > I have attached a document with the data and the code. I cannot create the
> > list results the way I have described above. It creates only the  matrices
> > for the first array (that has length equal to 135) of the first comparison
> > leaving the rest 10 comparisons "NULL".
> >
> > On Wed, Oct 24, 2012 at 5:17 PM, Richard M. Heiberger <[hidden email]>wrote:
> >
> >> I am looking at your pdf file.
> >>
> >> it doesn't match your description.
> >>
> >> There are no missing values in the vectors
> >> x, y, t.
> >> Each vector has length 55 which is not a multiple of 4,
> >> so we don't know where the 2x2 matrices come from.
> >>
> >> The code doesn't run.  There are are too many "}".
> >> PDF files are formatted and are not ascii.
> >>
> >> Please send your code in ascii text in the body of the email.
> >> Please pick it up from your email and paste it into
> >> a fresh R session to be sure that it works.
> >>
> >> Perhaps consrtruct manually an example of what you want the answer to look
> >> like.
> >>
> >> Rich
> >>
> >>
> >>
> >> On Wed, Oct 24, 2012 at 3:51 AM, Loukia Spineli <[hidden email]
> >>> wrote:
> >>
> >>> Dear all,
> >>>
> >>> I am trying to create a list, where each list element is a vector of
> >>> different length arrays that contain 2by2 matrices. To be more specific
> >>> there are 11 treatments that are compared with placebo (we have 11
> >>> comparisons) and each comparison is studied by a different number of
> >>> trials
> >>> and each trial has a different number of missing participants in both
> >>> arms.
> >>> The length of the list is equal to the number of comparisons. In each
> >>> comparison the number of arrays is equal to the number of trials that
> >>> study
> >>> this comparison. For instance 4 trials compare PAR with placebo. So, for
> >>> this comparison we have 4 arrays and each array has a length equal to the
> >>> producy of the number of participants in each arm. These arrays contain
> >>> 2x2
> >>> matrices.
> >>>
> >>> I have attached a document with the data and the code. I cannot create the
> >>> list results the way I have described above. It creates only the  matrices
> >>> for the first array (that has length equal to 135) of the first comparison
> >>> leaving the rest 10 comparisons "NULL".
> >>> Any suggestion would be  really helpful
> >>>
> >>> Thank you in advance,
> >>> Loukia
> >>>
> >>> ______________________________________________
> >>> [hidden email] 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.
> >>>
> >>>
> >>
> > <List of multidimensional arrays.pdf>______________________________________________
> > [hidden email] 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.
>
>

______________________________________________
[hidden email] 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.
ML
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

ML
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Richard M. Heiberger
In reply to this post by ML
With effort I re-inserted the line feeds in your code that the
pdf file deleted.
There is an error in your code

Error in 0:(x[t == i][l]) (from #9) : NA/NaN argument

>
> x[t == i]
[1] 8 2 9
> l
[1] 4
>

On Thu, Oct 25, 2012 at 7:45 AM, Loukia Spineli
<[hidden email]>wrote:

> x and y are the frequencies of missing participants in the intervention
> and the control treatment respectively! vector t contains the code of the
> interventions (we have 11 interventions). I re-attach the PDF with some
> small modifications. I am trying to create a list, where each list
> element is a vector of different length arrays that contain 2by2 matrices.
> To be more specific there are 11 treatments that are compared with placebo
> (we have 11 comparisons) and each comparison is studied by a different
> number of trials and each trial has a different number of missing
> participants in both arms. The length of the list is equal to the number of
> comparisons. In each comparison the number of arrays is equal to the number
> of trials that study this comparison. For instance 4 trials compare PAR
> with placebo. So, for this comparison we have 4 arrays and each array has a
> length equal to the producy of the number of participants in each arm.
> These arrays contain 2x2 matrices.
>
> I have attached a document with the data and the code. I cannot create the
> list results the way I have described above. It creates only the  matrices
> for the first array (that has length equal to 135) of the first comparison
> leaving the rest 10 comparisons "NULL".
>
> On Wed, Oct 24, 2012 at 5:17 PM, Richard M. Heiberger <[hidden email]>wrote:
>
>> I am looking at your pdf file.
>>
>> it doesn't match your description.
>>
>> There are no missing values in the vectors
>> x, y, t.
>> Each vector has length 55 which is not a multiple of 4,
>> so we don't know where the 2x2 matrices come from.
>>
>> The code doesn't run.  There are are too many "}".
>> PDF files are formatted and are not ascii.
>>
>> Please send your code in ascii text in the body of the email.
>> Please pick it up from your email and paste it into
>> a fresh R session to be sure that it works.
>>
>> Perhaps consrtruct manually an example of what you want the answer to
>> look like.
>>
>> Rich
>>
>>
>>
>> On Wed, Oct 24, 2012 at 3:51 AM, Loukia Spineli <
>> [hidden email]> wrote:
>>
>>> Dear all,
>>>
>>> I am trying to create a list, where each list element is a vector of
>>> different length arrays that contain 2by2 matrices. To be more specific
>>> there are 11 treatments that are compared with placebo (we have 11
>>> comparisons) and each comparison is studied by a different number of
>>> trials
>>> and each trial has a different number of missing participants in both
>>> arms.
>>> The length of the list is equal to the number of comparisons. In each
>>> comparison the number of arrays is equal to the number of trials that
>>> study
>>> this comparison. For instance 4 trials compare PAR with placebo. So, for
>>> this comparison we have 4 arrays and each array has a length equal to the
>>> producy of the number of participants in each arm. These arrays contain
>>> 2x2
>>> matrices.
>>>
>>> I have attached a document with the data and the code. I cannot create
>>> the
>>> list results the way I have described above. It creates only the
>>>  matrices
>>> for the first array (that has length equal to 135) of the first
>>> comparison
>>> leaving the rest 10 comparisons "NULL".
>>> Any suggestion would be  really helpful
>>>
>>> Thank you in advance,
>>> Loukia
>>>
>>> ______________________________________________
>>> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Richard M. Heiberger
Please use this model to send your data and code

> mydata <- data.frame(x, y, fx, fy)
> head(mydata)  ## just the first 6 rows are displayed on screen
   x y fx fy
1  4 3 37 40
2  4 3 21 20
3  0 0 65 50
4 12 0 91 49
5  1 5 22 20
6  2 3  6 10
> dump("mydata", "")
mydata <-
structure(list(x = c(4, 4, 0, 12, 1, 2, 0, 2, 6, 1, 0, 20, 6,
5, 20, 0, 0, 0, 4, 1, 0, 16, 0, 9, 7, 11, 0, 2, 3, 0, 10, 2,
1, 0, 3, 6, 4, 0, 20, 11, 1, 8, 0, 6, 15, 0, 2, 5, 2, 6, 24,
1, 11, 6, 9), y = c(3, 3, 0, 0, 5, 3, 0, 5, 4, 2, 0, 20, 6, 1,
18, 0, 0, 3, 3, 1, 0, 4, 0, 13, 7, 12, 0, 2, 2, 0, 2, 4, 0, 4,
2, 5, 0, 0, 23, 8, 0, 14, 0, 9, 20, 0, 2, 0, 2, 2, 14, 4, 1,
4, 7), fx = c(37, 21, 65, 91, 22, 6, 31, 41, 27, 5, 77, 33, 90,
26, 35, 35, 34, 30, 13, 24, 107, 122, 33, 18, 34, 23, 27, 8,
81, 6, 9, 38, 44, 18, 30, 37, 96, 8, 53, 56, 10, 71, 26, 36,
24, 73, 27, 46, 85, 46, 117, 17, 45, 51, 67), fy = c(40, 20,
50, 49, 20, 10, 36, 48, 39, 7, 72, 38, 71, 2, 69, 7, 7, 32, 32,
32, 34, 17, 26, 25, 140, 132, 36, 15, 35, 23, 19, 35, 35, 38,
30, 38, 103, 13, 61, 48, 17, 74, 33, 44, 28, 94, 24, 52, 70,
47, 118, 21, 52, 59, 84)), .Names = c("x", "y", "fx", "fy"), row.names =
c(NA,
-55L), class = "data.frame")
>

Now the reader can pick up the "mydata <- " ....
lines and paste them into the R session and reproduce what
you want us to see.

On Thu, Oct 25, 2012 at 9:53 AM, Richard M. Heiberger <[hidden email]>wrote:

> With effort I re-inserted the line feeds in your code that the
> pdf file deleted.
> There is an error in your code
>
> Error in 0:(x[t == i][l]) (from #9) : NA/NaN argument
>
> >
> > x[t == i]
> [1] 8 2 9
> > l
> [1] 4
> >
>
> On Thu, Oct 25, 2012 at 7:45 AM, Loukia Spineli <[hidden email]
> > wrote:
>
>> x and y are the frequencies of missing participants in the intervention
>> and the control treatment respectively! vector t contains the code of the
>> interventions (we have 11 interventions). I re-attach the PDF with some
>> small modifications. I am trying to create a list, where each list
>> element is a vector of different length arrays that contain 2by2 matrices.
>> To be more specific there are 11 treatments that are compared with placebo
>> (we have 11 comparisons) and each comparison is studied by a different
>> number of trials and each trial has a different number of missing
>> participants in both arms. The length of the list is equal to the number of
>> comparisons. In each comparison the number of arrays is equal to the number
>> of trials that study this comparison. For instance 4 trials compare PAR
>> with placebo. So, for this comparison we have 4 arrays and each array has a
>> length equal to the producy of the number of participants in each arm.
>> These arrays contain 2x2 matrices.
>>
>> I have attached a document with the data and the code. I cannot create
>> the list results the way I have described above. It creates only the
>>  matrices for the first array (that has length equal to 135) of the first
>> comparison leaving the rest 10 comparisons "NULL".
>>
>> On Wed, Oct 24, 2012 at 5:17 PM, Richard M. Heiberger <[hidden email]>wrote:
>>
>>> I am looking at your pdf file.
>>>
>>> it doesn't match your description.
>>>
>>> There are no missing values in the vectors
>>> x, y, t.
>>> Each vector has length 55 which is not a multiple of 4,
>>> so we don't know where the 2x2 matrices come from.
>>>
>>> The code doesn't run.  There are are too many "}".
>>> PDF files are formatted and are not ascii.
>>>
>>> Please send your code in ascii text in the body of the email.
>>> Please pick it up from your email and paste it into
>>> a fresh R session to be sure that it works.
>>>
>>> Perhaps consrtruct manually an example of what you want the answer to
>>> look like.
>>>
>>> Rich
>>>
>>>
>>>
>>> On Wed, Oct 24, 2012 at 3:51 AM, Loukia Spineli <
>>> [hidden email]> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I am trying to create a list, where each list element is a vector of
>>>> different length arrays that contain 2by2 matrices. To be more specific
>>>> there are 11 treatments that are compared with placebo (we have 11
>>>> comparisons) and each comparison is studied by a different number of
>>>> trials
>>>> and each trial has a different number of missing participants in both
>>>> arms.
>>>> The length of the list is equal to the number of comparisons. In each
>>>> comparison the number of arrays is equal to the number of trials that
>>>> study
>>>> this comparison. For instance 4 trials compare PAR with placebo. So, for
>>>> this comparison we have 4 arrays and each array has a length equal to
>>>> the
>>>> producy of the number of participants in each arm. These arrays contain
>>>> 2x2
>>>> matrices.
>>>>
>>>> I have attached a document with the data and the code. I cannot create
>>>> the
>>>> list results the way I have described above. It creates only the
>>>>  matrices
>>>> for the first array (that has length equal to 135) of the first
>>>> comparison
>>>> leaving the rest 10 comparisons "NULL".
>>>> Any suggestion would be  really helpful
>>>>
>>>> Thank you in advance,
>>>> Loukia
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

pinki751
In reply to this post by ML
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.
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

Richard M. Heiberger
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 <[hidden email]> 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.
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
ML
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

ML
CONTENTS DELETED
The author has deleted this message.
ML
Reply | Threaded
Open this post in threaded view
|

Re: List of multidimensional arrays

ML
CONTENTS DELETED
The author has deleted this message.