Learn R Programming

sfsmisc (version 0.9-4)

printTable2: Berechne und Drucke Randtotale etc f�r 2-weg Kontingenz Tafeln

Description

2-weg Kontingenztafel mit allem zusammen

margin2table() computes marginals adds them to the table and returns a margin2table object the print method for which adds text decorations (using "-" and "|").

Usage

printTable2(table2, digits = 3)
margin2table(x, totName = "sum")
## S3 method for class 'margin2table':
print(x, digits = 3, \dots)

Arguments

table2
Matrix mit Anzahlen, die Kontingenztafel.
x
a matrix, or the result of margin2table.
digits
Anzahl Dezimalstellen, auf die die H�ufigkeiten gerundet werden sollen.
totName
string to use as row- and column- name if x has corresponding dimnames.
...
further potential arguments, unused currently.

Value

  • margin2table returns a matrix with added marginals, i.e., an extra row and column, and is of class margin2table which has a nice print method.

    printTable2 is just producing output.

See Also

table, ftable.

Examples

Run this code
m <- diag(3); colnames(m) <- letters[1:3]
margin2table(m)
margin2table(m / sum(m))

data(HairEyeColor)
margin2table(HairEyeColor[,, "Male"])
printTable2(HairEyeColor[,, "Male"])
printTable2(HairEyeColor[,, "Female"])

Run the code above in your browser using DataLab