R Dataset / Package datasets / sleep


On this Picostat.com statistics page, you will find information about the sleep data set which pertains to Student's Sleep Data. The sleep data set is found in the datasets R package. You can load the sleep data set in R by issuing the following command at the console data("sleep"). This will load the data into a variable called sleep. If R says the sleep data set is not found, you can try installing the package by issuing this command install.packages("datasets") 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 sleep R data set. The size of this file is about 264 bytes.

Student's Sleep Data


Data which show the effect of two soporific drugs (increase in hours of sleep compared to control) on 10 patients.




A data frame with 20 observations on 3 variables.

[, 1] extra numeric increase in hours of sleep
[, 2] group factor drug given
[, 3] ID factor patient ID


The group variable name may be misleading about the data: They represent measurements on 10 persons, not in groups.


Cushny, A. R. and Peebles, A. R. (1905) The action of optical isomers: II hyoscines. The Journal of Physiology 32, 501–510.

Student (1908) The probable error of the mean. Biometrika, 6, 20.


Scheffé, Henry (1959) The Analysis of Variance. New York, NY: Wiley.


## Student's paired t-test
     t.test(extra[group == 1],
            extra[group == 2], paired = TRUE))## The sleep *prolongations*
sleep1 <- with(sleep, extra[group == 2] - extra[group == 1])
stripchart(sleep1, method = "stack", xlab = "hours",
           main = "Sleep prolongation (n = 10)")
boxplot(sleep1, horizontal = TRUE, add = TRUE,
        at = .6, pars = list(boxwex = 0.5, staplewex = 0.25))

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

Title Authored on Content type
R Dataset / Package psych / bfi March 9, 2018 - 1:06 PM Dataset
OpenIntro Statistics Dataset - scotus_healthcare August 9, 2020 - 2:38 PM Dataset
R Dataset / Package psych / withinBetween March 9, 2018 - 1:06 PM Dataset
R Dataset / Package Stat2Data / Kids198 March 9, 2018 - 1:06 PM Dataset
R Dataset / Package Ecdat / Wages1 March 9, 2018 - 1:06 PM Dataset
Attachment Size
dataset-97715.csv 264 bytes
Dataset License
GNU General Public License v2.0
Documentation License
GNU General Public License v2.0