[Rd] Data table in C

Tom McCallum tom.mccallum at levelelimited.com
Fri Nov 17 16:55:21 CET 2006


After getting one list done, I am now struggling to form a data frame in C.

I tried to do a list of lists which gives me :

$<NA>
$<NA>[[1]]
[1] "BID"

$<NA>[[2]]
[1] 0.6718

$<NA>[[3]]
[1] 3e+06


$<NA>
$<NA>[[1]]
[1] "BID"

$<NA>[[2]]
[1] 0.6717

$<NA>[[3]]
[1] 5e+06


$<NA>
$<NA>[[1]]
[1] "BID"

$<NA>[[2]]
[1] 0.6717

$<NA>[[3]]
[1] 17200000


and then as.data.frame them in R but this gives me

> print(l);
   X0.type X0.price X0.volume X1.type X1.price X1.volume X2.type X2.price
1     BID   0.6723     3e+06     BID   0.6722     5e+06     BID  0.67195
   X2.volume X3.type X3.price X3.volume X4.type X4.price X4.volume X5.type
1  19400000     BID   0.6723     3e+06     BID   0.6722     5e+06     BID
   X5.price X5.volume X6.type X6.price X6.volume X7.type X7.price X7.volume
1   0.6723     3e+06     BID   0.6723     3e+06     BID  0.67195  19400000
   X8.type X8.price X8.volume X9.type X9.price X9.volume X10.type X10.price
1     BID   0.6723     3e+06     BID  0.67215     1e+07      BID    0.6723
   X10.volume X11.type X11.price X11.volume X12.type X12.price X12.volume
1      5e+06      BID   0.67215      1e+07      BID    0.6723      3e+06

and so on.

Is the only way in C to do this or is there a better way of creating a 2  
dimensional data frame with names columns?  I could not find a  
"data.frame" object so I assume one has to use lists but I can't see how  
to get a 3 column list as the example below shows:

   a b d
1 1 4 7
2 2 5 8
3 3 6 9


Tom

-- 
Dr. Thomas McCallum
Systems Architect,
Level E Limited
ETTC, The King's Buildings
Mayfield Road,
Edinburgh EH9 3JL, UK
Work  +44 (0) 131 472 4813
Fax:  +44 (0) 131 472 4719
http://www.levelelimited.com
Email: tom at levelelimited.com

Level E is a limited company incorporated in Scotland. The c...{{dropped}}



More information about the R-devel mailing list