Skip to content

Instantly share code, notes, and snippets.

@bwarren2
Created October 27, 2014 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwarren2/a1097ecc7106296afb7c to your computer and use it in GitHub Desktop.
Save bwarren2/a1097ecc7106296afb7c to your computer and use it in GitHub Desktop.
setwd("~/Downloads")
df.lily = read.csv('lily.csv')
summary(df.lily)
str(df.lily)
colnames(df.lily)
df.lily$cat = ''
df.lily[df.lily$Falling.Asleep.Time==0,]$cat='Put To Sleep'
df.lily[df.lily$Falling.Asleep.Time!=0,]$cat='Self To Sleep'
library(lattice)
densityplot(~df.lily$Nap.Length, groups=df.lily$cat, xlab='Nap Length')
# Is the sleeping or waking happening at wildly different times? Nope. Different wake explained by duration.
densityplot(~df.lily$Sleep.Hour, groups=df.lily$cat, xlab='Wake Hour')
densityplot(~df.lily$Wake.Hour, groups=df.lily$cat, xlab='Wake Hour')
#Maybe hacking at the hour is too coarse? No.
densityplot(~df.lily$Sleep.Percent.of.Day, groups=df.lily$cat, xlab='Wake Hour')
densityplot(~df.lily$Wake.Percent.of.Day, groups=df.lily$cat, xlab='Wake Hour')
t.test(df.lily[df.lily$Falling.Asleep.Time==0,]$Nap.Length, df.lily[df.lily$Falling.Asleep.Time!=0,]$Nap.Length, "two.sided", 0, FALSE, TRUE, 0.95)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment