Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 5 a: Now we will clean the variable that measures how often the respondent ate fruit per day or per week or per month.

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.
brf_part1<- brf_part1%>%
mutate(
FRTDAY = case_when(
FRUIT2==300 ~ 0.02,
between(FRUIT2,101,199) ~ 200086,
between(FRUIT2,201,299) ~ round((123019/7),2),
between(FRUIT2,301,399) ~ round((56983/30),2),
FRUIT2==555 ~ 0,
FRUIT2==777 ~ NA_real_,
FRUIT2==999 ~ NA_real_,
TRUE ~ NA_real_
),
.before =1
)%>%
as.data.frame()
Label: How many times did you eat fruit?
Section Name: Fruits & Vegetables
Core Section Number: 15
Question Number: 1
Column: 240-242
Type of Variable: Num
SAS Variable Name: FRUIT2
Question Prologue:
Question: Not including juices, how often did you eat fruit?
Value Value Label Frequency Percentage
Weighted
Percentage
101-199 Days 200,08649.4647.76
201-299 Weeks 123,01930.4131.99
300 Less than once a month 3,5670.880.98
301-399 Month / Year 56,98314.0914.02
555 Never 11,0872.742.76
777 Dont know/Not sure 8,3462.062.09
999 Refused 1,4300.350.39
BLANK Not asked or Missing 34,175 can u correct my code using my format in R not python. i dont know what to use to divide the week n month

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

Step: 3

blur-text-image

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago