R Dataset / Package DAAG / science


On this R-data statistics page, you will find information about the science data set which pertains to School Science Survey Data. The science data set is found in the DAAG R package. You can load the science data set in R by issuing the following command at the console data("science"). This will load the data into a variable called science. If R says the science data set is not found, you can try installing the package by issuing this command install.packages("DAAG") and then attempt to reload the data. If you need to download R, you can go to the R project website. You can download a CSV (comma separated values) version of the science R data set. The size of this file is about 51,215 bytes.

School Science Survey Data


The science data frame has 1385 rows and 7 columns.

The data are on attitudes to science, from a survey where there were results from 20 classes in private schools and 46 classes in public schools.




This data frame contains the following columns:


a factor with levels ACT Australian Capital Territory, NSW New South Wales


a factor with levels private school, public school


a factor, coded to identify the school


a factor, coded to identify the class


a factor with levels f, m


a summary score based on two of the questions, on a scale from 1 (dislike) to 12 (like)


a factor with levels corresponding to each class


Francine Adams, Rosemary Martin and Murali Nayadu, Australian National University


classmeans <- with(science, aggregate(like, by=list(PrivPub, Class), mean))
names(classmeans) <- c("PrivPub","Class","like")
boxplot(split(like, PrivPub), ylab = "Class average of attitude to science score", boxwex = 0.4)
rug(like[PrivPub == "private"], side = 2)
rug(like[PrivPub == "public"], side = 4)
if(require(lme4, quietly=TRUE)) {
science.lmer <- lmer(like ~ sex + PrivPub + (1 | school) +
                     (1 | school:class), data = science,
science1.lmer <- lmer(like ~ sex + PrivPub + (1 | school:class),
                      data = science, na.action=na.exclude)
ranf <- ranef(obj = science1.lmer, drop=TRUE)[["school:class"]]
flist <- science1.lmer@flist[["school:class"]]
privpub <- science[match(names(ranf), flist), "PrivPub"]
num <- unclass(table(flist)); numlabs <- pretty(num)
## Plot effect estimates vs numbers
plot(sqrt(num), ranf, xaxt="n", pch=c(1,3)[as.numeric(privpub)],
     xlab="# in class (square root scale)",
     ylab="Estimate of class effect")
             ranf[privpub=="private"], f=1.1), lty=2)
             ranf[privpub=="public"], f=1.1), lty=3)
axis(1, at=sqrt(numlabs), labels=paste(numlabs))

Dataset imported from https://www.r-project.org.

Title Authored on Content type
OpenIntro Statistics Dataset - dream August 9, 2020 - 12:25 PM Dataset
OpenIntro Statistics Dataset - winery_cars August 9, 2020 - 2:38 PM Dataset
R Dataset / Package HSAUR / toothpaste March 9, 2018 - 1:06 PM Dataset
R Dataset / Package HSAUR / pottery March 9, 2018 - 1:06 PM Dataset
R Dataset / Package HistData / Guerry March 9, 2018 - 1:06 PM Dataset
<iframe src="https://r-data.pmagunia.com/iframe/r-dataset-package-daag-science.html" frameBorder="0" width="100%" height="307px" />
Attachment Size
dataset-42162.csv 50.01 KB
Dataset License
GNU General Public License v2.0
Documentation License
GNU General Public License v2.0

This documentation is licensed under GPLv3 or later.