Re: [R] inverse table

2016-06-16 Thread Michael Friendly
That function, expand.dft is in the vcdExtra package On 6/15/2016 12:42 PM, Marc Schwartz wrote: There is a function called expand.dft(), which I posted some years ago, which is a modification of a prior version, posted a few years before that. The updated version is here: https://stat.et

Re: [R] inverse table

2016-06-16 Thread Patrizio Frederic
[3,] "b" "A" > [4,] "b" "A" > [5,] "c" "A" > [6,] "d" "A" > > ----- > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77

Re: [R] inverse table

2016-06-15 Thread David L Carlson
ot; "A" [2,] "a" "A" [3,] "b" "A" [4,] "b" "A" [5,] "c" "A" [6,] "d" "A" - David L Carlson Department of Anthropology Texas A&M University College St

Re: [R] inverse table

2016-06-15 Thread Marc Schwartz
> On Jun 15, 2016, at 11:10 AM, Patrizio Frederic > wrote: > > Dear R-users, > I've a problem that puzzle me > > suppose I have a two way contigency table > > a <- sample(al <- letters[1:10],100,T) > b <- sample(bl <- LETTERS[1:5],100,T) > ab <- cbind(a,b) > > ddd <- (xtabs(data = ab)) > dd

Re: [R] inverse table

2016-06-15 Thread Leonardo Fontenelle
Em Qua 15 jun. 2016, às 13:10, Patrizio Frederic escreveu: > Dear R-users, > I've a problem that puzzle me > > suppose I have a two way contigency table > > a <- sample(al <- letters[1:10],100,T) > b <- sample(bl <- LETTERS[1:5],100,T) > ab <- cbind(a,b) > > ddd <- (xtabs(data = ab)) > ddd <- a

Re: [R] inverse table

2016-06-15 Thread Ulrik Stervbo
Hi Patrizio, maybe there is a more efficient way, but you can loop over rows and columns like this ab.recon <- data.frame() ddd.rownames <- rownames(ddd) ddd.colnames <- colnames(ddd) for(cur.row in ddd.rownames){ for(cur.col in ddd.colnames){ times.found <- ddd[cur.row, cur.col] tmp.

[R] inverse table

2016-06-15 Thread Patrizio Frederic
Dear R-users, I've a problem that puzzle me suppose I have a two way contigency table a <- sample(al <- letters[1:10],100,T) b <- sample(bl <- LETTERS[1:5],100,T) ab <- cbind(a,b) ddd <- (xtabs(data = ab)) ddd <- as.matrix(ddd) the question is: how do I reverse the code, thus how do I get raw