Question
Language: R The `HELPfull` data within the `mosaicData` package contains information about the Health Evaluation and Linkage to Primary Care (HELP) randomized trial in tall
Language: R
The `HELPfull` data within the `mosaicData` package contains information about the Health Evaluation and Linkage to Primary Care (HELP) randomized trial in tall format.
-
Generate a table of the data for subjects (ID) 1, 2, and 3 that includes the ID variable, the TIME variable, and the DRUGRISK and SEXRISK variables (measures of drug and sex risk-taking behaviors, respectively).
-
The HELP trial was designed to collect information at 0, 6, 12, 18, and 24 month intervals. At which timepoints were measurements available on the *RISK variables for subject 3?
-
Lets restrict our attention to the data from the baseline (TIME = 0) and 6-month data. Use the pivot_wider() function from the dplyr package to create a table that looks like the following:
# A tibble: 3 5 ID DRUGRISK_0 DRUGRISK_6 SEXRISK_0 SEXRISK_61 1 0 0 4 1 2 2 0 0 7 0 3 3 20 13 2 4
- Repeat this process using all subjects. What is the Pearson correlation between the baseline (TIME = 0) and 6-month DRUGRISK scores? Repeat this for the SEXRISK scores. (Hint: use the use = "complete.obs" option from the cor() function.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started