s-news
[Top] [All Lists]

query about split()

To: s-news@lists.biostat.wustl.edu
Subject: query about split()
From: "John Pitchard" <johnpitchard@googlemail.com>
Date: Fri, 13 Apr 2007 13:52:24 +0100
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=tgDs7l8nAD3fssBWZali/OQc8R7CAxt9CkOaMm9c/XQLj+IEKK9+xt+TMhf+9VS+oomakGgDmPOSX9RA9beLH2o2Kbw5iueiAzcR3dOPHcPib5amqfSmDPdtx+c7a0WM+9gliY+0oDD3HCge19nP862heqi2s65LIGsKSUAX0mU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=kRhlH4rVjMLs/mN3RI9ZuIxRJ9GaqVJjDkDBXtN3UQ/yyuz8OLOrIzZbliYlhryjU58ShVmCaUAqsDYWWNuMfaPVt6jxCyJtOVYALq9UhI7hyChaCJNymCbw8p+snchKCrd+OO3glwx20Q1/pyWyeFDbytKukrGZ0MCYAtdwoGU=
 
 
If I have the following matrix
 
> x <- matrix(1:72, ncol=6)
> x
      [,1] [,2] [,3] [,4] [,5] [,6]
 [1,]    1   13   25   37   49   61
 [2,]    2   14   26   38   50   62
 [3,]    3   15   27   39   51   63
 [4,]    4   16   28   40   52   64
 [5,]    5   17   29   41   53   65
 [6,]    6   18   30   42   54   66
 [7,]    7   19   31   43   55   67
 [8,]    8   20   32   44   56   68
 [9,]    9   21   33   45   57   69
[10,]   10   22   34   46   58   70
[11,]   11   23   35   47   59   71
[12,]   12   24   36   48   60   72
 
I would like to split it by the following matrix
> y <- matrix(1:12, ncol=6)
> y
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    3    5    7    9   11
[2,]    2    4    6    8   10   12
 
so that I have a list with 6 items the first containing
 
1, 3, 5, 7, 9, 11
 
 
split(x, y) doesn't give the result that i'm looking for. Does anyone know how this is done?
 
 
Thanks in advance.
Regards,
John
 
<Prev in Thread] Current Thread [Next in Thread>
  • query about split(), John Pitchard <=