Skip to content
Prev 294407 / 398502 Next

categorical analysis - grouping rows

Hello,

If the output of ftable is kept in an object named 'ft', try this.


ftperc <- t(apply(ft, 1, function(x)
     if(sum(x)) round(100*x/sum(x)) else rep(0, length(x))))
attributes(ftperc) <- attributes(ft)
ftperc


(And if you need it to process several datasets, a function with 'ft' as 
the argument and the code above as its body is straightforward to write.)

Hope this helps,

Rui Barradas

Em 13-05-2012 11:00, r-help-request at r-project.org escreveu: