
describe(x=NULL, ...)## S3 method for class 'numeric':
describe(x, digits.d=NULL, lbl=NULL, \dots)
## S3 method for class 'factor':
describe(x, lbl=NULL, \dots)
## S3 method for class 'formula':
describe(formula, data=mydata, \dots)
## S3 method for class 'data.frame':
describe(x, \dots)
## S3 method for class 'character':
describe(x, lbl=NULL, \dots)
## S3 method for class 'default':
describe(x, \dots)
formula
of the form Y ~ X, where Y is the
numeric response variable compared across the two groups, and X is a grouping variable (factor) with two levels that define the corresponding groups.digits
which specifies the number of decimal digits to display in the output when calling with a formula.The digits.d
parameter specifies the number of decimal digits in the output. It must follow the formula specification when used with the formula version. By default the number of decimal digits displayed for the analysis of a variable is one more than the largest number of decimal digits in the data for that variable.
The function rad
in this package reads the data from an external csv file into the data frame called mydata. To describe all of the variables in this data frame, invoke describe(mydata), or just describe(), which then defaults to the former.
summary
, formula
.# ----------------------------------------------------------
# Data simulated, call describe with a formula
# ----------------------------------------------------------
# Create simulated data, no population mean difference
# X has two values only, Y is numeric
n <- 12
X <- sample(c("Group1","Group2"), size=n, replace=TRUE)
Y <- round(rnorm(n=n, mean=50, sd=10),3)
# Analyze all the values of numerical Y and categorical X
describe(Y)
describe(X)
# Analyze data with formula version
# Get the summary statistics for Y at each level of X
# Specify 3 decimal digits for each statistic displayed
describe(Y ~ X, digits.d=2)
# Analyze a small example data set from the web
# Read data into mydata data frame with the rad function
# Optionally display the data frame by listing its name
# Analyze all variables in the data table with describe()
#rad("http://web.pdx.edu/~gerbing/data/employees2.csv")
#mydata
#describe()
# Use the subset function to specify a variable list
#describe(subset(mydata, select=c(Age:Dept,HealthPlan)))
Run the code above in your browser using DataLab