epiorder: Reorder data for epi table ( 2by2 table).

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/freq.R

Description

epiorder Rearrange order of factor variable to produce classical epi table 1/0 Yes/No +/-

Usage

1
epiorder(var, mode = "yesno", levels = NULL, update = TRUE, reverse = FALSE)

Arguments

var

Variable to reorder (will be converted as factor).

mode

Label plan for the new factor variable "yesno" for Yes, No "10" for 1, 0 "+-" for +,- "truefalse" for TRUE, FALSE or any set of two labels on the form c("A","B")

levels

Custom set of levels as vector : c(1,0) This levels will replaced by the lables then levels and labels should have the same length and the same order

update

if TRUE (the default) Then the original dataset is updated with new value The recoded column is replaced by the returned value With this option, there is no need to reassign the retruned value, but original data are lost.

reverse

if TRUE labels are reordered to better fit epidemiological tables with 1 before 0 , Yes before No etc... Other type of label are not changed, existing factor are not changed

Value

A vector reordered Can be nested as in freq(epioredr(case))

Author(s)

Gilles Desve

References

Based on: Epi6 and Stata functionnality, available at https://github.com/.

See Also

epitable for cross tabulation

Examples

1
2
3
4
## Not run: 
epiorder(c(0,1,0,1,1))

## End(Not run)

gdesve/epifield documentation built on Jan. 23, 2022, 10:03 a.m.