This is my first ever RMD presentation. Really exciting!
25/12/2021
This is my first ever RMD presentation. Really exciting!
library(dplyr)
actData<-read.csv("activity.csv", sep=',', header=TRUE)
actData <- mutate(actData, hour = interval %/% 100, minute = interval %% 100)
dailySteps<-c() # This will be the total number of steps taken per day
for (i in 1:61){ # total number of days in October and November is 31+30=61
start<-(i-1)*288+1 # 288 five-minute steps in a day; 24*60/5=288
last<-(i-1)*288+288
t<-actData[start:last,1] # extracting all 5-minute steps for each day
dailySteps<-c(dailySteps,sum(t)) # concatenating the daily totals
}
dailySteps02<-dailySteps[!is.na(dailySteps)]
[1] 126 11352 12116 13294 15420 11015 12811 9900 10304 17382 12426 15098 [13] 10139 15084 13452 10056 11829 10395 8821 13460 8918 8355 2492 6778 [25] 10119 11458 5018 9819 15414 10600 10571 10439 8334 12883 3219 12608 [37] 10765 7336 41 5441 14339 15110 8841 4472 12787 20427 21194 14478 [49] 11834 11162 13646 10183 7047