Description Usage Arguments Details Value Author(s) Examples
Produces a vector containing summary measures computed within clusters.
1 2 |
y |
a vector, |
cluster |
vector, matrix, or list of variables defining clusters. Descriptive statistics will be computed within strata defined by each unique combination of the cluster variables. |
stat |
a character string indicating the descriptive statistic(s) to be returned for each
cluster. See the documentation for |
subset |
a logical vector indicating a subset to be used for all descriptive statistics. |
x |
a numeric vector to be used as regression predictor for least squares slopes. |
... |
optional arguments specifying quantiles or thresholds for probabilities to be used
in calculating summary statistics. See arguments for |
version |
if |
This function uses tableStat() to compute stratified statistics for each cluster. However, only single summary measures can be used in this function. See examples.
A vector is returned that contains the summary statistic relevant for the cluster to which each observation in y belings. Although only the cases indicated by subset are used to calculate the summary statistics, values are expanded out to cases beyond those indicated by subset.
Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson, Travis Y. Hee Wai, and Solomon Lim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Load required libraries
library(survival)
# Reading in a dataset
audio <- read.csv("http://www.emersonstatistics.com/datasets/audio.csv",header=TRUE)
# Generating counts for each subject
counts <- clusterStats (audio$R4000, audio$Subject, "count")
table(counts,strata=audio$Dose)
# Generating average R4000 for each subject
mR4000 <- clusterStats (audio$R4000, audio$Subject, "mean")
descrip(mR4000,strata=audio$Dose)
# Generating average R4000 for each subject after visit 0
mtxR4000 <- clusterStats (audio$R4000, audio$Subject, "mean", subset=audio$Visit>0)
descrip(mtxR4000,strata=audio$Dose)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.