---
# System prepended metadata

title: Code Review

---

# Code Review

- **Reviewer**: Dylan Simburger
- **Author**: Harshvardhan Singh
- **Original repository**: https://github.com/ISTA421INFO521/homework-1-f22-Harshvardhan-Singh1/

------------------

## Additional comments

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)  **Comment 1**
- Line 126: use of replicate for creating multiple samples
- Rather than using a for loop in line 126 to create 100 samples of the 20 elements, replicate can be used to do the operate in a single line of code (ex. replicate(# of times to replicate, specific operation to replicate())

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 2**
- Effective use of comments
- Comments could be used to better explain operations taking place in the code

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 3**
- Use of dplyr package
- dplyr is a package in R that simplifies several commands in R and allows for an easier manipulation of data and code (ex. case_when command, mutate command, and piping of code)

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 4**
- Line 152: use of rnorm to sample
- mean= and sd= are not needed to specify what the mean and standard dev. of the distribution should be. Putting the number after the comma will give the correct mean and sd as well (ex. rnorm(100, 81, 0.26)). However, this might make code less clear and effective commenting would be required for legibility. 

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 5**
- Good use of data.frame
- My code to create data frames included cbind.data.frame but your approach to creating data frames using just data.frame was a simpler and more graceful approach.

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 6**
- Effective use of for loops
- I had to download dplyr and use their more simple commands to get around for loops but your use of them was effective and helped me better understand how to use them and how they work

![#1589F0](https://via.placeholder.com/15/1589F0/1589F0.png)   **Comment 7**
- Line 235: Code simplification
- The line of code on 235 to get the mean BMI of gender group A can be re-written more simply as mean(gawh$BMI[gawh$Gender=="A"]). This calculates the mean BMI of the pulled down elements of Gender "A".

------------------
## Overview

- [x] The code is well-designed.
- [x] The functionality is good for the users of the code.
- [x] The code isn’t more complex than it needs to be.
- [x] The developer isn’t implementing things they might need in the future but don’t know they need now.
- [x] Code has appropriate unit tests (optional).
- [x] Tests are well-designed (optional).
- [x] The developer used clear names for everything.
- [x] Comments are clear and useful, and mostly explain why instead of what.
- [ ] Code is appropriately documented 
- [x] Aesthetics

------------------
<div align="center">
<img src="https://octodex.github.com/images/Adacats.png" width="500">
<p>Thanks for your comments!</p>
</div>
