[R] Data frame/read.ftable

Robinson, David G drobin at sandia.gov
Thu Dec 3 01:02:11 CET 2009


My apologies for this question but I¹m stuck and I¹m sure that there must be
an easy answer out there (and hope that someone will have mercy and point me
in the right direction).

I have a data file that looks like:
1 77 3
1 8 1
1 7 2
1 1 5
1 42 7
1 0 2
1 23 1
2 83 9
2 8 2
2 6 5
2 23 3
3 11 3
3 8 1
.
.... etc.
.
N   3   2


(FWIW, these are document, word reference, and word frequency counts.) I
want to read the data into data frame, Doc, such that
Doc[[1]]=
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]    77    8    7    1    42    0    23
[2,]    3    1    2    5     7    2     1

Doc[[2]]=
     [,1] [,2] [,3] [,4]
[1,]    83    8    6    23
[2,]    9    2    5    3

Etc. 


It seems like I should be able to do this using a flat contingency table
method such as 'read.ftable' or possibly using 'stack' . However, something
is not clicking and hence my plea for assistance.

Thanks in advance, 
Dave Robinson
drobin at sandia.gov




More information about the R-help mailing list