Try prop.table(tab, 1) prop.table(tab, 2) prop.table(tab)
for the three ways of taking fractions or see ?CrossTable in the gmodels package. On 4/30/07, lalitha viswanath <[EMAIL PROTECTED]> wrote: > Hi > I have data of the form > class age > A 0.5 > B 0.4 > A 0.56666 > C 0.785 > D 0.535 > A 0.005 > C 0.015 > D 0.205 > A 0.605 > > etc etc... > > I tabulated the above > as > tab <-table(data$class, cut(data$age, seq(0,0.6,0.02)) > > I wish to view the results in individual bins as a > percentage of the points in each bin. > So I tried > tab/colSums(tab) > > However that is yielding Inf as a return value in > places where clearly the result should be a non-zero > value. > > Is there an alternate way to get the results in each > bin as percentages of the total points in that > age-bin? > > Thanks > Lalitha > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.