report.quanti
Creates a desc object of "quantitative" statistics
report.quanti
Returns quantitative descriptive statistics such as mean, median, standard deviation etc...
Usage
report.quanti(data, y, x1 = NULL, x2 = NULL, y.label = y,
round = 2, total = F, scientific = F, digits = NULL,
at.row = NULL, subjid = NULL, geomean = F)
Arguments
- data
Data.frame object
- y
Character indicating a numerical vector in the data frame passed to
data
argument- 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 lines)
- y.label
Character. Indicates the label for y parameter
- round
Numeric to indicate how to round statistics
- total
Logical to indicate if a "Total" column should be added
- scientific
Logical to indicate if statistics should be displayed in scientific notations
- digits
Numeric (used if scientifc=T) to indicate how many digits to use in scientific notation
- at.row
a character. Used to space the results (see example below)
- subjid
Character. Indicates the column in which there is the subject Id to add the number of subjects in the column header if x1 and x2 are not null.
- geomean
Boolean. If yes geometric mean is calculated instead of arithmetic mean: (exp(mean(log(x),na.rm=T))) fpr x>0
Details
This function computes and reports quantitative statistics on y
. And can gives the statistics by level of two factors (x1
in columns and/or x2
in rows).
See the example to show the results. If total=T
, the last column is the statistics
performed overall levels of x1
for each levels of x2
.
Quantiles are calculated using type 3 (SAS) algorithms.
"geomean" compute the geometric mean defined as exp(mean(log(y))). The values below or equal 0 are removed and a message is printed to indicate how many values were deleted to calculate the geometric mean.
N
returns the number of observations (including NA values)
Value
A desc object.
See Also
Examples
# NOT RUN {
data(data)
# Quantitative statistics with no factor
report.quanti(data=data,y="y_numeric",y.label="Awesome results")
#' # Quantitative statistics with no factor with geometric mean (option geomean=TRUE)
report.quanti(data=data,y="y_numeric",y.label="Awesome results",geomean=TRUE)
# Quantitative statistics with one factor
report.quanti(data=data,y="y_numeric",x1="GROUP")
# One factor with total column
report.quanti(data=data,y="y_numeric",x1="GROUP",total=TRUE)
# Quantitative statistics with two factors
report.quanti(data=data,y="y_numeric",x1="GROUP",x2="TIMEPOINT")
# Quantitative statistics with two factors and a total column
report.quanti(data=data,y="y_numeric",x1="GROUP",x2="TIMEPOINT",total=TRUE)
# Quantitative statistics with spacing rows (option at.row)
report.quanti(data=data,y="y_numeric",x1="GROUP",
x2="TIMEPOINT",total=TRUE,at.row="TIMEPOINT")
# Add number of subjects in headers (option subjid)
report.quanti(data=data,y="y_numeric",x1="GROUP",
x2="TIMEPOINT",total=TRUE,at.row="TIMEPOINT",subjid="SUBJID")
# }