diff --git a/PA1_template.Rmd b/PA1_template.Rmd
index d5cc677c93d..f37dcf1e0f2 100644
--- a/PA1_template.Rmd
+++ b/PA1_template.Rmd
@@ -1,25 +1,89 @@
----
-title: "Reproducible Research: Peer Assessment 1"
-output:
- html_document:
- keep_md: true
----
+#Call the libraries
+library(tidyverse)
+library(mice)
-## Loading and preprocessing the data
+#Read the downloaded data from the desktop
+activity <- read.csv("C:/Users/zterjek/Desktop/activity.csv")
+#Calculate the total steps taken per day, visualize it with a histogram
-## What is mean total number of steps taken per day?
+perdaysum <- aggregate(steps ~ date, activity, sum)
+hist(perdaysum$steps, breaks = 20, col = "steelblue")
+#Calculate and report the average and median of total taken steps
-## What is the average daily activity pattern?
+perdaymean <- mean(perdaysum$steps)
+perdaymed <- median(perdaysum$steps)
+perdaymean
+perdaymed
-## Imputing missing values
+#Calculate the average steps taken by intervals, visualize it with a line chart
+perintervalmean <- aggregate(steps ~ interval, activity, mean)
+plot(perintervalmean$interval, perintervalmean$steps, type = "l", col = "darkred",
+ lwd = 1.5)
-## Are there differences in activity patterns between weekdays and weekends?
+#Calculate and report the interval when max steps were taken
+
+maxstepsperinterval <- max(perintervalmean$steps)
+
+maxstepsinterval <- filter(perintervalmean, steps == maxstepsperinterval)
+
+maxstepsinterval$interval
+
+#Calculate the missing values
+
+md.pattern(activity)
+
+#Impute the missing values with predictive mean matching
+
+activity_imputed <- data.frame(original = activity$steps,
+ imputed_steps = complete(mice(activity, method = "pmm"))$steps)
+
+activity_imputed$num <- 1:17568
+activity$num <- 1:17568
+
+merged_activity <- merge(activity, activity_imputed, by = "num")
+merged_activity <- merged_activity[,-c(1, 2)]
+merged_activity <- rename(merged_activity, original_steps = original)
+md.pattern(merged_activity)
+
+#Calculate the total steps taken per day of the imputed dataset,
+#visualize it with a histogram
+
+perdaysum_merged <- aggregate(imputed_steps ~ date, merged_activity, sum)
+
+hist(perdaysum_merged$imputed_steps, breaks = 20, col = "darkgreen")
+
+#Calculate and report the average and median of total taken steps in the
+#imputed dataset
+
+perdaymean_merged <- mean(perdaysum_merged$imputed_steps)
+
+perdaymed_merged <- median(perdaysum_merged$imputed_steps)
+
+perdaymean_merged
+perdaymed_merged
+
+#Checking the weekdays
+
+merged_activity$date <- as.Date(merged_activity$date)
+
+merged_activity$daytype <- as.factor(ifelse(weekdays(merged_activity$date) %in%
+ c("szombat", "vasárnap"), "Weekend", "Weekday"))
+
+#Calculate the average steps taken by intervals, visualize it with a line chart
+#with weekdays and weekends separated
+
+grouped <- merged_activity %>% group_by(daytype, interval) %>%
+ summarize_at("imputed_steps", mean)
+
+ggplot(grouped, aes(interval, imputed_steps))+
+ geom_line(aes(col = daytype))+
+ facet_wrap(.~ grouped$daytype, nrow = 2, ncol = 1)
diff --git a/PA1_template.md b/PA1_template.md
new file mode 100644
index 00000000000..a97e0baaa2e
--- /dev/null
+++ b/PA1_template.md
@@ -0,0 +1,180 @@
+RepData_PeerAssessment1_TZs
+Zsolt Terjek
+2023-06-03
+Calling the libraries
+
+library(tidyverse)
+## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
+## ✔ dplyr 1.1.1 ✔ readr 2.1.4
+## ✔ forcats 1.0.0 ✔ stringr 1.5.0
+## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
+## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
+## ✔ purrr 1.0.1
+## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
+## ✖ dplyr::filter() masks stats::filter()
+## ✖ dplyr::lag() masks stats::lag()
+## ℹ Use the conflicted package () to force all conflicts to become errors
+library(mice)
+##
+## Attaching package: 'mice'
+##
+## The following object is masked from 'package:stats':
+##
+## filter
+##
+## The following objects are masked from 'package:base':
+##
+## cbind, rbind
+
+### Loading and preprocessing the data
+
+Reading the data downloaded to the desktop
+
+activity <- read.csv("C:/Users/zterjek/Desktop/activity.csv")
+
+### What is mean total number of steps taken per day?
+
+Calculate the total steps taken per day, visualize it with a histogram
+
+perdaysum <- aggregate(steps ~ date, activity, sum)
+
+hist(perdaysum$steps, breaks = 20, col = "steelblue")
+
+
+
+Calculate and report the average and median of total taken steps
+
+perdaymean <- mean(perdaysum$steps)
+
+perdaymed <- median(perdaysum$steps)
+
+perdaymean
+## [1] 10766.19
+perdaymed
+## [1] 10765
+
+### What is the average daily activity pattern?
+
+Calculate the average steps taken by intervals, visualize it with a line chart
+
+perintervalmean <- aggregate(steps ~ interval, activity, mean)
+
+plot(perintervalmean$interval, perintervalmean$steps, type = "l", col = "darkred",
+ lwd = 1.5)
+
+
+
+Calculate and report the interval when max steps were taken
+
+maxstepsperinterval <- max(perintervalmean$steps)
+
+maxstepsinterval <- filter(perintervalmean, steps == maxstepsperinterval)
+
+maxstepsinterval$interval
+## [1] 835
+
+### Imputing missing values
+
+Calculate and report the interval when max steps were taken
+
+maxstepsperinterval <- max(perintervalmean$steps)
+
+maxstepsinterval <- filter(perintervalmean, steps == maxstepsperinterval)
+
+maxstepsinterval$interval
+## [1] 835
+Impute the missing values with predictive mean matching
+
+md.pattern(activity)
+
+
+
+
+## date interval steps
+## 15264 1 1 1 0
+## 2304 1 1 0 1
+## 0 0 2304 2304
+
+activity_imputed <- data.frame(original = activity$steps,
+ imputed_steps = complete(mice(activity, method = "pmm"))$steps)
+##
+## iter imp variable
+## 1 1 steps
+## 1 2 steps
+## 1 3 steps
+## 1 4 steps
+## 1 5 steps
+## 2 1 steps
+## 2 2 steps
+## 2 3 steps
+## 2 4 steps
+## 2 5 steps
+## 3 1 steps
+## 3 2 steps
+## 3 3 steps
+## 3 4 steps
+## 3 5 steps
+## 4 1 steps
+## 4 2 steps
+## 4 3 steps
+## 4 4 steps
+## 4 5 steps
+## 5 1 steps
+## 5 2 steps
+## 5 3 steps
+## 5 4 steps
+## 5 5 steps
+## Warning: Number of logged events: 1
+
+activity_imputed$num <- 1:17568
+activity$num <- 1:17568
+
+merged_activity <- merge(activity, activity_imputed, by = "num")
+merged_activity <- merged_activity[,-c(1, 2)]
+merged_activity <- rename(merged_activity, original_steps = original)
+md.pattern(merged_activity)
+
+
+
+## date interval imputed_steps original_steps
+## 15264 1 1 1 1 0
+## 2304 1 1 1 0 1
+## 0 0 0 2304 2304
+
+Calculate the total steps taken per day of the imputed dataset, visualize it with a histogram
+
+perdaysum_merged <- aggregate(imputed_steps ~ date, merged_activity, sum)
+
+hist(perdaysum_merged$imputed_steps, breaks = 20, col = "darkgreen")
+
+
+
+Calculate and report the average and median of total taken steps in the imputed dataset
+
+perdaymean_merged <- mean(perdaysum_merged$imputed_steps)
+
+perdaymed_merged <- median(perdaysum_merged$imputed_steps)
+
+perdaymean_merged
+## [1] 10479.26
+perdaymed_merged
+## [1] 10439
+
+
+### Are there differences in activity patterns between weekdays and weekends?
+
+Checking the weekdays
+
+merged_activity$date <- as.Date(merged_activity$date)
+
+merged_activity$daytype <- as.factor(ifelse(weekdays(merged_activity$date) %in% c("szombat", "vasárnap"), "Weekend", "Weekday"))
+Calculate the average steps taken by intervals, visualize it with a line chart with weekdays and weekends separated
+
+grouped <- merged_activity %>% group_by(daytype, interval) %>%
+ summarize_at("imputed_steps", mean)
+
+ggplot(grouped, aes(interval, imputed_steps))+
+ geom_line(aes(col = daytype))+
+ facet_wrap(.~ grouped$daytype, nrow = 2, ncol = 1)
+
+
diff --git a/PAI_template_TZs.html b/PAI_template_TZs.html
new file mode 100644
index 00000000000..762403d1f9f
--- /dev/null
+++ b/PAI_template_TZs.html
@@ -0,0 +1,540 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Calling the libraries
+
library(tidyverse)
+
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
+## ✔ dplyr 1.1.1 ✔ readr 2.1.4
+## ✔ forcats 1.0.0 ✔ stringr 1.5.0
+## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
+## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
+## ✔ purrr 1.0.1
+## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
+## ✖ dplyr::filter() masks stats::filter()
+## ✖ dplyr::lag() masks stats::lag()
+## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
+
library(mice)
+
##
+## Attaching package: 'mice'
+##
+## The following object is masked from 'package:stats':
+##
+## filter
+##
+## The following objects are masked from 'package:base':
+##
+## cbind, rbind
+
Reading the data downloaded to the desktop
+
activity <- read.csv("C:/Users/zterjek/Desktop/activity.csv")
+
Calculate the total steps taken per day, visualize it with a
+histogram
+
perdaysum <- aggregate(steps ~ date, activity, sum)
+
+hist(perdaysum$steps, breaks = 20, col = "steelblue")
+

+
Calculate and report the average and median of total taken steps
+
perdaymean <- mean(perdaysum$steps)
+
+perdaymed <- median(perdaysum$steps)
+
+perdaymean
+
## [1] 10766.19
+
perdaymed
+
## [1] 10765
+
Calculate the average steps taken by intervals, visualize it with a
+line chart
+
perintervalmean <- aggregate(steps ~ interval, activity, mean)
+
+plot(perintervalmean$interval, perintervalmean$steps, type = "l", col = "darkred",
+ lwd = 1.5)
+

+
Calculate and report the interval when max steps were taken
+
maxstepsperinterval <- max(perintervalmean$steps)
+
+maxstepsinterval <- filter(perintervalmean, steps == maxstepsperinterval)
+
+maxstepsinterval$interval
+
## [1] 835
+
Impute the missing values with predictive mean matching
+
md.pattern(activity)
+

+
## date interval steps
+## 15264 1 1 1 0
+## 2304 1 1 0 1
+## 0 0 2304 2304
+
activity_imputed <- data.frame(original = activity$steps,
+ imputed_steps = complete(mice(activity, method = "pmm"))$steps)
+
##
+## iter imp variable
+## 1 1 steps
+## 1 2 steps
+## 1 3 steps
+## 1 4 steps
+## 1 5 steps
+## 2 1 steps
+## 2 2 steps
+## 2 3 steps
+## 2 4 steps
+## 2 5 steps
+## 3 1 steps
+## 3 2 steps
+## 3 3 steps
+## 3 4 steps
+## 3 5 steps
+## 4 1 steps
+## 4 2 steps
+## 4 3 steps
+## 4 4 steps
+## 4 5 steps
+## 5 1 steps
+## 5 2 steps
+## 5 3 steps
+## 5 4 steps
+## 5 5 steps
+
## Warning: Number of logged events: 1
+
activity_imputed$num <- 1:17568
+activity$num <- 1:17568
+
+merged_activity <- merge(activity, activity_imputed, by = "num")
+merged_activity <- merged_activity[,-c(1, 2)]
+merged_activity <- rename(merged_activity, original_steps = original)
+md.pattern(merged_activity)
+

+
## date interval imputed_steps original_steps
+## 15264 1 1 1 1 0
+## 2304 1 1 1 0 1
+## 0 0 0 2304 2304
+
Calculate the total steps taken per day of the imputed dataset,
+visualize it with a histogram
+
perdaysum_merged <- aggregate(imputed_steps ~ date, merged_activity, sum)
+
+hist(perdaysum_merged$imputed_steps, breaks = 20, col = "darkgreen")
+

+
Calculate and report the average and median of total taken steps in
+the imputed dataset
+
perdaymean_merged <- mean(perdaysum_merged$imputed_steps)
+
+perdaymed_merged <- median(perdaysum_merged$imputed_steps)
+
+perdaymean_merged
+
## [1] 10479.26
+
perdaymed_merged
+
## [1] 10439
+
Checking the weekdays
+
merged_activity$date <- as.Date(merged_activity$date)
+
+merged_activity$daytype <- as.factor(ifelse(weekdays(merged_activity$date) %in% c("szombat", "vasárnap"), "Weekend", "Weekday"))
+
Calculate the average steps taken by intervals, visualize it with a
+line chart with weekdays and weekends separated
+
grouped <- merged_activity %>% group_by(daytype, interval) %>%
+ summarize_at("imputed_steps", mean)
+
+ggplot(grouped, aes(interval, imputed_steps))+
+ geom_line(aes(col = daytype))+
+ facet_wrap(.~ grouped$daytype, nrow = 2, ncol = 1)
+

+
End of code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
deleted file mode 100644
index 05763414e69..00000000000
--- a/README.md
+++ /dev/null
@@ -1,168 +0,0 @@
-## Introduction
-
-It is now possible to collect a large amount of data about personal
-movement using activity monitoring devices such as a
-[Fitbit](http://www.fitbit.com), [Nike
-Fuelband](http://www.nike.com/us/en_us/c/nikeplus-fuelband), or
-[Jawbone Up](https://jawbone.com/up). These type of devices are part of
-the "quantified self" movement -- a group of enthusiasts who take
-measurements about themselves regularly to improve their health, to
-find patterns in their behavior, or because they are tech geeks. But
-these data remain under-utilized both because the raw data are hard to
-obtain and there is a lack of statistical methods and software for
-processing and interpreting the data.
-
-This assignment makes use of data from a personal activity monitoring
-device. This device collects data at 5 minute intervals through out the
-day. The data consists of two months of data from an anonymous
-individual collected during the months of October and November, 2012
-and include the number of steps taken in 5 minute intervals each day.
-
-## Data
-
-The data for this assignment can be downloaded from the course web
-site:
-
-* Dataset: [Activity monitoring data](https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2Factivity.zip) [52K]
-
-The variables included in this dataset are:
-
-* **steps**: Number of steps taking in a 5-minute interval (missing
- values are coded as `NA`)
-
-* **date**: The date on which the measurement was taken in YYYY-MM-DD
- format
-
-* **interval**: Identifier for the 5-minute interval in which
- measurement was taken
-
-
-
-
-The dataset is stored in a comma-separated-value (CSV) file and there
-are a total of 17,568 observations in this
-dataset.
-
-
-## Assignment
-
-This assignment will be described in multiple parts. You will need to
-write a report that answers the questions detailed below. Ultimately,
-you will need to complete the entire assignment in a **single R
-markdown** document that can be processed by **knitr** and be
-transformed into an HTML file.
-
-Throughout your report make sure you always include the code that you
-used to generate the output you present. When writing code chunks in
-the R markdown document, always use `echo = TRUE` so that someone else
-will be able to read the code. **This assignment will be evaluated via
-peer assessment so it is essential that your peer evaluators be able
-to review the code for your analysis**.
-
-For the plotting aspects of this assignment, feel free to use any
-plotting system in R (i.e., base, lattice, ggplot2)
-
-Fork/clone the [GitHub repository created for this
-assignment](http://github.com/rdpeng/RepData_PeerAssessment1). You
-will submit this assignment by pushing your completed files into your
-forked repository on GitHub. The assignment submission will consist of
-the URL to your GitHub repository and the SHA-1 commit ID for your
-repository state.
-
-NOTE: The GitHub repository also contains the dataset for the
-assignment so you do not have to download the data separately.
-
-
-
-### Loading and preprocessing the data
-
-Show any code that is needed to
-
-1. Load the data (i.e. `read.csv()`)
-
-2. Process/transform the data (if necessary) into a format suitable for your analysis
-
-
-### What is mean total number of steps taken per day?
-
-For this part of the assignment, you can ignore the missing values in
-the dataset.
-
-1. Make a histogram of the total number of steps taken each day
-
-2. Calculate and report the **mean** and **median** total number of steps taken per day
-
-
-### What is the average daily activity pattern?
-
-1. Make 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 days (y-axis)
-
-2. Which 5-minute interval, on average across all the days in the dataset, contains the maximum number of steps?
-
-
-### Imputing missing values
-
-Note that there are a number of days/intervals where there are missing
-values (coded as `NA`). The presence of missing days may introduce
-bias into some calculations or summaries of the data.
-
-1. Calculate and report the total number of missing values in the dataset (i.e. the total number of rows with `NA`s)
-
-2. Devise a strategy for filling in all of the missing values in the dataset. The strategy does not need to be sophisticated. For example, you could use the mean/median for that day, or the mean for that 5-minute interval, etc.
-
-3. Create a new dataset that is equal to the original dataset but with the missing data filled in.
-
-4. Make a histogram of the total number of steps taken each day and Calculate and report the **mean** and **median** total number of steps taken per day. Do these values differ from the estimates from the first part of the assignment? What is the impact of imputing missing data on the estimates of the total daily number of steps?
-
-
-### Are there differences in activity patterns between weekdays and weekends?
-
-For this part the `weekdays()` function may be of some help here. Use
-the dataset with the filled-in missing values for this part.
-
-1. 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.
-
-1. 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). The plot should look something like the following, which was created using **simulated data**:
-
-
-
-
-**Your plot will look different from the one above** because you will
-be using the activity monitor data. Note that the above plot was made
-using the lattice system but you can make the same version of the plot
-using any plotting system you choose.
-
-
-## Submitting the Assignment
-
-To submit the assignment:
-
-1. Commit your completed `PA1_template.Rmd` file to the `master` branch of your git repository (you should already be on the `master` branch unless you created new ones)
-
-2. Commit your `PA1_template.md` and `PA1_template.html` files produced by processing your R markdown file with the `knit2html()` function in R (from the **knitr** package)
-
-3. If your document has figures included (it should) then they should have been placed in the `figure/` directory by default (unless you overrode the default). Add and commit the `figure/` directory to your git repository.
-
-4. Push your `master` branch to GitHub.
-
-5. Submit the URL to your GitHub repository for this assignment on the course web site.
-
-In addition to submitting the URL for your GitHub repository, you will
-need to submit the 40 character SHA-1 hash (as string of numbers from
-0-9 and letters from a-f) that identifies the repository commit that
-contains the version of the files you want to submit. You can do this
-in GitHub by doing the following:
-
-1. Go into your GitHub repository web page for this assignment
-
-2. Click on the "?? commits" link where ?? is the number of commits you have in the repository. For example, if you made a total of 10 commits to this repository, the link should say "10 commits".
-
-3. You will see a list of commits that you have made to this repository. The most recent commit is at the very top. If this represents the version of the files you want to submit, then just click the "copy to clipboard" button on the right hand side that should appear when you hover over the SHA-1 hash. Paste this SHA-1 hash into the course web site when you submit your assignment. If you don't want to use the most recent commit, then go down and find the commit you want and copy the SHA-1 hash.
-
-A valid submission will look something like (this is just an **example**!)
-
-```r
-https://github.com/rdpeng/RepData_PeerAssessment1
-
-7c376cc5447f11537f8740af8e07d6facc3d9645
-```