Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Continue with Data, in R . ### Q 5 a: Now we will clean the variable that measures how often the respondent ate fruit per

Continue with Data, in R.
### Q5a: Now we will clean the variable that measures how often the respondent ate fruit per day or per week or per month. Create a new variable in `brf_part1` named `FRTDAY` that converts all of the responses into fruits eaten *per day*. Be sure to account for 0 days. Use 30 days per month, 7 days per week, and 0.02 for less than once a month in your conversion calculations. Place the new column as the first column in the dataframe.
Make sure you added the new column FRTDAY to the existing `brf_part1` dataframe.
The resulting dataframe should still have NAs for FRTDAY at this point.
Hint: The resulting dataframe is 431,750 x 4.
```{r}
Q5a
```
### Q5b: Update the `FRTDAY` column in the dataframe `brf_part1` by removing the respondents who said "don't know/not sure" or refused to respond. Drop the original fruit variable from the `brf_part1` dataframe (but keep FRTDAY). Store the first 10 rows of the dataframe as `Q5.`
Hint: The resulting dataframe is 422,747 x 3. Be sure the variables are in this order (left to right): FRTDAY, the length of time variable, then the general health variable.
```{r}
### Do not edit the following line. It is used by CodeGrade.
# CG Q5 #
### TYPE YOUR CODE BELOW ###
### VIEW OUTPUT ###
Q5
```

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions