gazeCat: Summary function for categorical variable

View source: R/gaze_sub.R

gazeCatR Documentation

Summary function for categorical variable

Description

Summary function for categorical variable

Usage

gazeCat(
  data,
  x,
  y = NULL,
  max.ylev = 5,
  digits = 1,
  show.total = FALSE,
  show.n = FALSE,
  show.missing = FALSE,
  show.stats = TRUE,
  origData = NULL,
  show.p = TRUE,
  method = 1,
  catMethod = 2,
  maxCatLevel = 20,
  ...
)

Arguments

data

A data frame

x

Name of a categorical variable

y

Name of a variable, either continuous or categorical

max.ylev

max.ylev An integer indicating the maximum number of levels of grouping variable ('y'). If a column have unique values less than max.ylev it is treated as a categorical variable. Default value is 5.

digits

Numeric

show.total

logical. Whether or not show total column

show.n

logical. Whether or not show N column

show.missing

logical. Whether or not show missing column

show.stats

logical. Whether or not show stats column

origData

A data.frame containing original data

show.p

logical. Whether or not show p column

method

method An integer indicating methods for continuous variables. Possible values in methods are 1 forces analysis as normal-distributed 2 forces analysis as continuous non-normal 3 performs a Shapiro-Wilk test or nortest::ad.test to decide between normal or non-normal Default value is 1.

catMethod

An integer indicating methods for categorical variables. Possible values in methods are

0

Perform chisq.test first. If warning present, perform fisher test

1

Perform chisq.test without continuity correction

2

Perform chisq.test with continuity correction

3

perform fisher.test

4

perform prop.trend test

Default value is 2.

maxCatLevel

An integer indicating the maximum number of unique levels of categorical variable. If a column have unique values more than maxCatLevel, categorical summarization will not be performed.

...

Further arguments

Value

An object of class "data.frame" or "tibble"

Examples

require(moonBook)
gazeCat(acs,"Dx")
gazeCat(acs,"Dx","smoking")
gazeCat(acs,"sex","Dx",show.p=TRUE)
gazeCat(acs,"Dx","sex",show.p=TRUE)
gazeCat(acs,"Dx","EF")
gazeCat(acs,"sex","EF",method=2)
gazeCat(mtcars,"cyl","hp")

autoReg documentation built on Nov. 14, 2023, 9:07 a.m.