# generate some example data
data <- sample(c(1:7,NA), 600, T)
datafra <- data.frame(matrix(data, ncol=6))
names(datafra) <- c("var1","var2","var3","var4","var5","var6")
# frequency tables
table(data, useNA="ifany")
apply(datafra, 2, table, useNA="ifany")
# histogram and barplot
hist(data)
par(mfrow=c(2,3)); apply(datafra, 2, hist)
barplot(apply(datafra, 2, table))
# descriptives
summary(data)
sd(data, na.rm=T)
apply(datafra,2, summary)
apply(datafra, 2, sd, na.rm=T)
No comments:
Post a Comment