Learn R Programming

HH (version 3.1-47)

sufficient: Calculates the mean, standard deviation, and number of observations in each group of a data.frame that has one continuous variable and two factors.

Description

Calculates the mean, standard deviation, and number of observations in each group of a data.frame that has one continuous variable and two factors.

Usage

sufficient(x,
           yname = dimnames(x)[[2]][[1]],
           factor.names.keep = dimnames(x)[[2]][-c(1, 2)])

Arguments

x

data.frame containing a continuous variable and two factors.

yname

Character name of response variable.

factor.names.keep

Character vecotr containing the names of two factors in the x data.frame.

Value

Data.frame containing five columns and as many rows as are implied by the crossing of the two factors. Each row contains the mean in a column with the name yname and its factor values in columns named with the name in factor.names.keep. The standard deviation of the observations in the group are in the column "sd" and the number of observations in the group is in the column "nobs".

See Also

intxplot