# Introduction to Data Science HW 4##### Copyright Jeffrey Stanton, Jeffrey Saltz, and Jasmina Tacheva
```{r}# Enter your name here:```
### Attribution statement: (choose only one and delete the rest)
```{r}# 1. I did this homework by myself, with help from the book and the professor.# 2. I did this homework with help from the book and the professor and these Internet sources:# 3. I did this homework with help from but did not cut and paste any code.```
Reminders of things to practice from previous weeks:
Descriptive statistics: mean( ) max( ) min( )
Coerce to numeric: as.numeric( )
## Part 1: Use the Starter Code
Below, I have provided a starter file to help you.
Each of these lines of code **must be commented** (the comment must that explains what is going on, so that I know you understand the code and results).
```{r}library(jsonlite)dataset readlines df ```
A. Explore the **df** dataframe (e.g., using head() or whatever you think is best).
```{r}
```
B. Explain the dataset
o What is the dataset about?
o How many rows are there and what does a row represent?
o How many columns and what does each column represent?
```{r}
```
C. What does running this line of code do? Explain in a comment:
```{r}vals ```
D. Create a new attribute 'age' - how old the person is**Hint:** You may need to convert it to numeric first.
```{r}
```
E. Create a function that reads in the role json dataset, and adds the age attribute to the dataframe, and returns that dataframe
```{r}
```
F. Use (call, invoke) the function, and store the results in df
```{r}
```
## Part 2: Investigate the resulting dataframe 'df'
A. How many senators are women?
```{r}
```
B. How many senators have a YouTube account?
```{r}
```
C. How many women senators have a YouTube account?
```{r}
```
D. Create a new dataframe called **youtubeWomen** that only includes women senators who have a YouTube account.
```{r}
```
E. Make a histogram of the **age** of senators in **youtubeWomen**, and then another for the senetors in **df**. Add a comment describing the shape of the distributions.
```{r}