# ----------------------------------------------------------
# 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