I am currently trying to transpose some large panel data set ie transposing 
multiple rows in into a single column. instead the transpose functionality 
transposes all rows into columns. my sample data set looks like below:

 
 
 
 
 
 
  ACCT_NUM
  ACCOUNT_NAME
  TRAN_AMT
  DATE
  EMPLOYER
 
 
  101913
  GK
  7489
  30-Apr-10
  PENSION
 
 
  101913
  GK
  7489
  30-May-10
  PENSION
 
 
  101913
  GK
  7489
  30-Jun-10
  PENSION
 
 
  101913
  GK
  7489
  31-Jul-10
  PENSION
 
 
  101913
  GK
  7489
  31-Jan-10
  PENSION
 
 
  101913
  GK
  7489
  28-Feb-10
  PENSION
 
 
  101913
  GK
  7489
  31-Mar-10
  PENSION
 
 
  101913
  GK
  7489
  30-Oct-10
  PENSION
 
 
  101913
  GK
  7489
  30-Aug-10
  PENSION
 
 
  101913
  GK
  7489
  23-Sep-10
  PENSION
 
 
  101913
  GK
  53772
  30-Sep-10
  MKU
 
 
  101920
  CKM
  22739.7
  31-Jul-10
  POLICE
 
 
  101920
  CKM
  18327.6
  30-Sep-10
  POLICE
 
 
  101920
  CKM
  8840.4
  31-Mar-10
  POLICE
 
 
  101920
  CKM
  8986.25
  24-May-10
  POLICE
 
 
  101920
  CKM
  34252.2
  30-Jun-10
  POLICE
 
 
  101920
  CKM
  8913.35
  30-Apr-10
   POLICE
 

 
Ideally i would like a row to have one row of  ACCT_NUM and TranAmount and 
Date be transposed to columns.

Thanks









Kind regards,
  Tabitha Mundia ,      Project Management  Office,       Equity Bank 
Limited,P.O. Box 75104-00200
       Head Office, Upper  hill,       NHIF BLDG, 14th  Floor,   Nairobi, Kenya 
             Direct Extension : +254732112721          Mobile: +254722309538  
     Email: tabitha.mun...@equitybank.co.keskype ID: twamaeYahoo ID: 
tabygath...@yahoo.com


An idea not coupled with action will never get any bigger than the brain cell 
it occupied.
Arnold Glasgow
......
"Attempt something large enough that failure is guaranteed…unless God steps 
in!"


--- On Mon, 12/20/10, Kohleth Chia <kohl...@gmail.com> wrote:

From: Kohleth Chia <kohl...@gmail.com>
Subject: [R] package "arules" - 'transpose' of the transactions
To: r-help@r-project.org
Date: Monday, December 20, 2010, 8:41 AM

Suppose this is my list of
 transactions:


set.seed(200)

tran=random.transactions(100,3)

inspect(tran)

  items    transactionID
1 {item80}        trans1
2 {item8,
   item20}        trans2
3 {item28}        trans3


I want to get the 'transpose' of the data, i.e.

  transactionID  items
1 {trans2}        item8
2 {trans2}        item20
3 {trans3}        item28
4 {trans1}        item80


I tried converting tran into a matrix, then transpose it, then convert it
back to transactions. But my dataset is actually very very large, so I
wonder if there is any faster method?

Thanks

-- 
KC

    [[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]]

______________________________________________
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.

Reply via email to