JI=list(DateofBirth = lubridate::ymd("1951-02-09"), DateMarried = lubridate ::ymd("1972-02-09"), 'Universities Attended'='3', 'State of Birth'='Washington')
library(lubridate)
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
JI
## $DateofBirth
## [1] "1951-02-09"
##
## $DateMarried
## [1] "1972-02-09"
##
## $`Universities Attended`
## [1] "3"
##
## $`State of Birth`
## [1] "Washington"
age<-time_length(interval(JI$DateofBirth,Sys.Date()),"years")
age
## [1] 68.19726
yearsmarried<-time_length(interval(JI$DateMarried,Sys.Date()),"years")
age
## [1] 68.19726
I used the Crime Dataset.
my.dat <- read.csv("Crime_Data.csv")
str(my.dat)
## 'data.frame': 520179 obs. of 11 variables:
## $ Report.Number : num 1.98e+12 1.98e+12 1.98e+12 1.98e+13 1.98e+12 ...
## $ Occurred.Date : Factor w/ 4596 levels "","01/01/1973",..: 4393 4 385 2963 605 3423 3536 2043 4294 1 ...
## $ Occurred.Time : int 900 1 1600 2029 2000 155 2213 0 1130 NA ...
## $ Reported.Date : Factor w/ 4273 levels "01/01/1999","01/01/2006",..: 4085 371 481 2747 555 3179 3281 1936 3988 1 ...
## $ Reported.Time : int 1500 2359 1430 2030 435 155 2213 844 1700 NA ...
## $ Crime.Subcategory : Factor w/ 31 levels "","AGGRAVATED ASSAULT",..: 7 25 9 14 7 17 14 26 9 29 ...
## $ Primary.Offense.Description: Factor w/ 144 levels "ADULT-VULNERABLE-FINANCIAL",..: 19 113 124 44 19 133 43 128 124 131 ...
## $ Precinct : Factor w/ 7 levels "","EAST","NORTH",..: 4 6 2 4 5 7 4 5 4 6 ...
## $ Sector : Factor w/ 24 levels "","6804","9512",..: 18 1 9 19 23 14 18 8 16 1 ...
## $ Beat : Factor w/ 65 levels "","B1","B2","B3",..: 51 1 21 54 63 37 50 17 43 1 ...
## $ Neighborhood : Factor w/ 59 levels "ALASKA JUNCTION",..: 29 58 9 7 50 52 11 24 53 58 ...
my.dat[is.na(my.dat$Occurred.Time),]
## Report.Number Occurred.Date Occurred.Time Reported.Date Reported.Time
## 10 1.999e+13 NA 01/01/1999 NA
## 123 2.007e+13 NA 01/01/2007 NA
## Crime.Subcategory Primary.Offense.Description Precinct Sector Beat
## 10 THEFT-SHOPLIFT THEFT-SHOPLIFT UNKNOWN
## 123 RAPE RAPE-OTHER UNKNOWN
## Neighborhood
## 10 UNKNOWN
## 123 UNKNOWN
my.dat[is.na(my.dat$Reported.Time),]
## Report.Number Occurred.Date Occurred.Time Reported.Date Reported.Time
## 10 1.999e+13 NA 01/01/1999 NA
## 123 2.007e+13 NA 01/01/2007 NA
## Crime.Subcategory Primary.Offense.Description Precinct Sector Beat
## 10 THEFT-SHOPLIFT THEFT-SHOPLIFT UNKNOWN
## 123 RAPE RAPE-OTHER UNKNOWN
## Neighborhood
## 10 UNKNOWN
## 123 UNKNOWN
my.dat[is.na(as.character(my.dat$Reported.Tim)),]
## Report.Number Occurred.Date Occurred.Time Reported.Date Reported.Time
## 10 1.999e+13 NA 01/01/1999 NA
## 123 2.007e+13 NA 01/01/2007 NA
## Crime.Subcategory Primary.Offense.Description Precinct Sector Beat
## 10 THEFT-SHOPLIFT THEFT-SHOPLIFT UNKNOWN
## 123 RAPE RAPE-OTHER UNKNOWN
## Neighborhood
## 10 UNKNOWN
## 123 UNKNOWN
After running a structure command, I found 2 observations with missing Occured.Time and Reported.Time variables. Since I do not know when these specific crime observations occurred and reported, I cannot alter these NA values.
As part of my experiment, I will set exercise times three times a week, and also set a fixed sleeping schedule. I expect to see my daily step count, water intake, and reported mood levels to change as a result of the intervention.
Hypothesis: Running 3-4 times a week will increase my average step count, water intake, and increase my mood level.