ClinReport (version 0.9.1.1)

report.quali: Creates a desc object of "qualitative" statistics (frequencies and percentages) in a pretty format

Description

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

Usage

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)

Arguments

data

a data.frame object

y

Character indicating a factor in the data

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 parameter (only used when x1 and x2 are NULL)

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

Boolean. 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

Boolean. 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).

Value

A desc object

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 percentages.

See Also

report.quanti report.doc

Examples

Run this code
# NOT RUN {
 
data(data)

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

# 1 explicative variable (option x1:  levels in columns)
report.quali(data=data,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=data,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=data,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=data,y="y_logistic",x1="GROUP",
x2="TIMEPOINT",at.row="TIMEPOINT",subjid="SUBJID")

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


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



# }

Run the code above in your browser using DataLab