Re: [R] Generalising to n-dimensions

2008-09-26 Thread Laura Bonnett
Sorry to hassle you, but I really need to get my code up and running. Please can you therefore explain what a and v are? Thank you, Laura On Wed, Sep 24, 2008 at 8:27 PM, Laura Bonnett [EMAIL PROTECTED]wrote: Can I ask what a and v are? Thanks, Laura On Sat, Aug 23, 2008 at 11:41 AM,

Re: [R] Generalising to n-dimensions

2008-09-26 Thread Robin Hankin
Laura Bonnett wrote: Sorry to hassle you, but I really need to get my code up and running. Please can you therefore explain what a and v are? Hi Laura. I've been away (in Norwich). Sorry not to give an example. Variable 'a' is an array and variable 'd' is the same as in your original

Re: [R] Generalising to n-dimensions

2008-09-24 Thread Laura Bonnett
Can I ask what a and v are? Thanks, Laura On Sat, Aug 23, 2008 at 11:41 AM, Robin Hankin [EMAIL PROTECTED] wrote: Laura Bonnett wrote: crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] crosstable is just a crosstabulation of an n+2-dimensional dataset and I am trying to

[R] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
Hi R-helpers, I have two queries relating to generalising to n dimensions: What I want to do in the first one is generalise the following statement: expand-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers and expand.grid gives every combination of the set of numbers, so for

Re: [R] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] crosstable is just a crosstabulation of an n+2-dimensional dataset and I am trying to pick out those that are in combination 'd' of expand. So for example, for 5-dimensional data using your example: Var1 Var2 Var3 1 11

Re: [R] Generalising to n-dimensions

2008-09-23 Thread Robin Hankin
First bit: x - c(3,2,2) expand.grid(sapply(x,seq_len)) Var1 Var2 Var3 1 111 2 211 3 311 4 121 5 221 6 321 7 112 8 212 9 312 10122 11222 12322

Re: [R] Generalising to n-dimensions

2008-09-23 Thread Robin Hankin
Laura Bonnett wrote: crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] crosstable is just a crosstabulation of an n+2-dimensional dataset and I am trying to pick out those that are in combination 'd' of expand. So for example, for 5-dimensional data using your example: Var1