From 8aa2017909dac4f1dd45155fce04a43ad871b815 Mon Sep 17 00:00:00 2001 From: OO-yink Date: Mon, 4 Apr 2022 08:30:47 +0100 Subject: [PATCH] adding assignment --- .DS_Store | Bin 0 -> 6148 bytes Data/activity.csv | 17569 +++++++++++++++++++++++++++++++ Reproducible research PA 1.Rmd | 145 + 3 files changed, 17714 insertions(+) create mode 100644 .DS_Store create mode 100644 Data/activity.csv create mode 100644 Reproducible research PA 1.Rmd diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0% + mutate(wday = wday(date, label = TRUE)) %>% + ggplot(aes(x = wday)) + geom_bar() +``` + +### Create a new factor variable in the dataset with two levels - “weekday” and “weekend” indicating whether a given date is a weekday or weekend day. +```{r} +agg_df$week_split <- ifelse(weekdays(agg_df$date) %in% c("Saturday", "Sunday"), "Weekend", "Weekday") +agg_df$week_split <- as.factor(agg_df$week_split ) +head(agg_df) +``` + +### Make a panel plot containing a time series plot (i.e. type = “l”) of the 5-minute interval (x-axis) and the average number of steps taken, averaged across all weekday days or weekend days (y-axis) +```{r} +ggplot(agg_df, aes(x=interval, y=steps, group=week_split)) + + geom_line() + + ggtitle("Week Split") + + xlab("Intervals") + + ylab("Steps") + + facet_wrap(~ week_split) +``` + +