xtab: Cross tabulation

Description Usage Arguments Details Author(s) See Also Examples

View source: R/xtab.R

Description

xtab generates cross tabulation of two variables.

Usage

1
xtab(x, y, data = NULL, row.pct = TRUE, na.rm = FALSE, rnd = 1)

Arguments

x

a factor object

y

a factor object

data

a data frame object (Optional)

row.pct

a logical value: if NULL, a default table without any percentages is produced. If TRUE, row percentages are shown and if FALSE, column percentages.

na.rm

A logical value to specify missing values, <NA> in the table

rnd

specify rounding of numbers. See round.

Details

Exploring data before jumping into complex analysis is always a necessity. The first step of an analysis is always to summarize and display data.

tab produce two-way table of frequencies

References:

  1. Essential Medical Statistics, Betty R. Kirkwood & Jonathan A.C. Sterne, Second Edition. Chapter 3

  2. An Introduction to MEdical Statistics, Martin Bland, Thrid Edition, Chapter 4

Author(s)

Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)

See Also

tab

Examples

1
2
3
4
5
6
7
8
9
str(infert)
xtab(infert$education, infert$induced)
xtab(education, induced, infert)
xtab(case, induced, infert)
xtab(spontaneous, induced, infert)

xtab(spontaneous, induced, infert, row.pct = FALSE)
xtab(spontaneous, induced, infert, rnd = 2)
xtab(spontaneous, induced, infert)

myominnoo/stats2 documentation built on Nov. 4, 2019, 8:33 p.m.