report.quali: Descriptive "Qualitative" statistics (frequencies and...

Description Usage Arguments Details Value See Also Examples

View source: R/report.quali.R

Description

Compute and report frequencies and percentages by levels of y (in rows) and by levels of x1 (in columns) and x2 in rows.

For more examples see the website: ClinReport website

Usage

1
2
3
4
5
report.quali(data, y = NULL, x1 = NULL, x2 = NULL, y.label = y,
  x2.label = NULL, y.levels.label = "Levels", total = F, round = 2,
  at.row = NULL, percent.col = T, subjid = NULL, remove.zero = F,
  drop.y = NULL, drop.x1 = NULL, drop.x2 = NULL,
  remove.missing = F)

Arguments

data

a data.frame object

y

Character indicating a factor in the data (the response)

x1

Character indicating a factor in the data (levels will be displayed in columns)

x2

Character indicating a factor in the data (levels will be displayed in rows). Only possible if x1 is not NULL.

y.label

Character indicating the label for y to be displayed in the title of the table

x2.label

Character indicating the label for x2 parameter, only if x2 is not null

y.levels.label

Character. Indicates the label of the column in which the levels of y are displayed

total

Logical Indicates if a column Total should be added or not

round

Integer Indicates the number of digits to round percentages

at.row

Character. Pass to spacetable function. Used to space the results (see example below)

percent.col

Logical By default it is set to T to indicate that column percentages should be reported. If set to False, row percentages are reported.

subjid

Character Indicates in the data.frame the name of the column used to identify the Id of the subjects. If not null, it adds in the headers the number of unique subject per levels of x1 or y (if x1 is null).

remove.zero

Logical. Remove the levels in the contingency table for which there is no observation.

drop.y

Character. Indicates one or several levels of the y factor that you want to drop in the result

drop.x1

Character. Indicates one or several levels of the x1 factor that you want to drop in the result

drop.x2

Character. Indicates one or several levels of the x2 factor that you want to drop in the result

remove.missing

Logical. default to TRUE. If TRUE number of missing values are reported and percentages take into account the number of missing value in the calculation. If set to FALSE, the missing values regarding the response factor y are ignored and percentages are computed on non missing values only.

Details

This function computes and reports qualitative statistics by level of y and by level of x1 (if not null) and x2 (if not null).

See examples to show the results. If total=T, the last column is the statistics performed overall levels of the explicative variables x1.

Note that missing values are counted in the calculation of the percentages.

Value

A desc object

See Also

report.quanti report.doc desc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
data(datafake)

# No explicative variable changing y labels (option y.levels.label)
report.quali(data=datafake,y="y_logistic",
y.label="Clinical cure",y.levels.label="Levels")

# 1 explicative variable (option x1:  levels in columns)
report.quali(data=datafake,y="y_logistic",x1="GROUP",y.levels.label="Clinical cure")

# 2 explicative variables (x1, levels in columns, option x2, levels in rows),
# spcacing the results (option at.row)
report.quali(data=datafake,y="y_logistic",x1="GROUP",
x2="TIMEPOINT",y.levels.label="Clinical cure",x2.label="Days",at.row="Days")

# 2 explicative variables with row percentages (option percent.col=F)
report.quali(data=datafake,y="y_logistic",x1="GROUP",
x2="TIMEPOINT",percent.col=FALSE,x2.label="Days",y.levels.label="Clinical cure")

# Add Total number of subjects in headers (option subjid="SUBJID")
report.quali(data=datafake,y="y_logistic",x1="GROUP",
x2="TIMEPOINT",at.row="TIMEPOINT",subjid="SUBJID")

# Round percentages to 1 digit (option round=1)
report.quali(data=datafake,y="y_logistic",x1="GROUP",
x2="TIMEPOINT",at.row="TIMEPOINT",subjid="SUBJID",round=1)


# Qualitative statistics with a response with more than one levels
tab=report.quali(data=datafake,y="y_poisson",x1="GROUP",
x2="TIMEPOINT",at.row="TIMEPOINT",subjid="SUBJID",round=1)

# Print formatted results
tab


#Getting raw output (unformatted) 
tab$raw.output

ClinReport documentation built on Sept. 3, 2019, 5:07 p.m.