Reason, I need to do this in awk and not R:
Let's say 'x' is the tabular representation of a sparse contingency table
> x
x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 Freq
10 0 0 2 2 2 0 2 0 2 54
51 0 0 2 2 2 0 2 1 21
61 0 1 0 2 2 0
Can anyone point out why this is not working?
y<-read.table(pipe(' awk '{ n = $1; sub( ".*" $1 " " ,"") ; while ( n-- )
print }' temp.txt '))
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailm
I have a sparse contingency table (most cells are 0):
> xtabs(~.,data[,idx:(idx+4)])
, , x3 = 1, x4 = 1, x5 = 1
x2
x11 2 3
1 0 0 31
2 0 0 112
3 0 0 94
, , x3 = 2, x4 = 1, x5 = 1
x2
x11 2 3
1 0 0 0
2 0 0 0
3 0 0 0
, , x3 = 3, x4
I have a matrix y:
> dimnames(y)
$x93
[1] "1" "2"
$x94
[1] "0" "1" "2"
.. so on (there are other dimensions as well)
I need to access a particular dimension, but a random mechanism tells me
which dimension it would. So, sometimes I might need to access
dimnames(y)$x93, some ot
Neat! Thanks.
On 10/5/07, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
>
> On 10/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > I have an application that would generate a cross-tabulation in array
> > format in R. In particular, my application would give me a result
> > similar to that of
I have an application that would generate a cross-tabulation in array
format in R. In particular, my application would give me a result
similar to that of :
array(5,c(2,2,2,2,2))
The above could be seen as a cross-tabulation of 5 variables with 2
levels each (could be 0 and 1). In this case, the
6 matches
Mail list logo