The Behavioral Risk Factor Surveillance Survey is conducted biannually We have t
ID: 3173333 • Letter: T
Question
The Behavioral Risk Factor Surveillance Survey is conducted biannually We have the data from 1970 and 1990. The following measurements were made on each individual surveyed: weight: measured in pounds, with a value of 999 for missing height: measured in inches age: measured in years daysSick: number of days in the past 30 days that health was not good. Values include 1 to 30. "None" is coded as 88. last Checkup: time since last routine checkup. Values are 1 foe within a year, 2 for more than 1 and less than 2 years, 3 for more than 2 and less than 5 years, 4 for more than 5 years, and NA for don't know. phone: the respondent was contacted by land line (1) or cell phone (2). The data are in a data frame called BRFSS. To prepare the data for analysis, write code to perform each of the following operations. Recode the "number of days sick" so that 88 is 0. Convert a weight of 999 to NA. Turn lastCheckup into a factor with appropriate labels for the levels(reminder, use factor command that requires variable name and labels as arguments) Drop all records from the data frame that have a value of NA for the time of the last check up. (Assign the smaller data frame to BRFSS2).Explanation / Answer
The data is not given in the question , howeber i shall be able to provide you the syntax of the questions asked
is df is the dataframe and sick is the variable
use
b) Create an index and then set them to zero
c) Use as.factor on the variable to be converted
df$lastcheckup <- as.factor(df$lastcheckup)
d) use complete. cases to drop the NAs
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.