s-news
[Top] [All Lists]

split() and rep() question

To: s-news@lists.biostat.wustl.edu
Subject: split() and rep() question
From: Martyn Colins <martyncollins10@yahoo.com>
Date: Thu, 5 Oct 2006 08:05:25 -0700 (PDT)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=zGbuFrnQKjzEuioPbp++I3VCY8K1yWoPUbcy49sx2Hu317kRoFF3rVuOpc4CqBegAfC1gubKBjPYF0YK7miFxNEs/zZ8zJSS3QhiAnVMI1KJiPfmU+5D5DKNHJGSHLM6Rc3rNOJh4WLrSuMk6AN/RxH8BXHCeBmcW9Xvkyv90aw= ;
 
Dear all,
 
I have a matrix similar to this:
 
[,1] [,2] [,3]
[1,] 1 16 31
[2,] 2 17 32
[3,] 3 18 33
[4,] 4 19 34
[5,] 5 20 35
[6,] 6 21 36
[7,] 7 22 37
[8,] 8 23 38
[9,] 9 24 39
[10,] 10 25 40
[11,] 11 26 41
[12,] 12 27 42
[13,] 13 28 43
[14,] 14 29 44
[15,] 15 30 45
 
 
and I would like an efficient method to produce
 
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
[1,] 1 2 3 4 5 16 17 18 19 20 31 32 33 34 35
[2,] 1 2 3 4 5 16 17 18 19 20 31 32 33 34 35
[3,] 1 2 3 4 5 16 17 18 19 20 31 32 33 34 35
[4,] 1 2 3 4 5 16 17 18 19 20 31 32 33 34 35
[5,] 1 2 3 4 5 16 17 18 19 20 31 32 33 34 35
[6,] 6 7 8 9 10 21 22 23 24 25 36 37 38 39 40
[7,] 6 7 8 9 10 21 22 23 24 25 36 37 38 39 40
[8,] 6 7 8 9 10 21 22 23 24 25 36 37 38 39 40
[9,] 6 7 8 9 10 21 22 23 24 25 36 37 38 39 40
[10,] 6 7 8 9 10 21 22 23 24 25 36 37 38 39 40
[11,] 11 12 13 14 15 26 27 28 29 40 41 42 43 44 45
[12,] 11 12 13 14 15 26 27 28 29 40 41 42 43 44 45
[13,] 11 12 13 14 15 26 27 28 29 40 41 42 43 44 45
[14,] 11 12 13 14 15 26 27 28 29 40 41 42 43 44 45
[15,] 11 12 13 14 15 26 27 28 29 40 41 42 43 44 45
 
Does anyone know how to do this? Been trying various ways to split the matrix using split() and rep() but can't seem to do it.
 
Thanks in advance for your help.
 
Best,
Martyn


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
<Prev in Thread] Current Thread [Next in Thread>