-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhomework03.Rmd
48 lines (36 loc) · 2.18 KB
/
homework03.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "Homework 03"
---
## Homework 03 - due 09/30/2020
Using the HELP dataset:
* create "Table 1"
* provide the summary stats for the baseline data - overall and by randomization group (Usual Care versus the HELP Clinic)
- HELP dataset variables to include: `age, female, racegrp, homeless, a15a, a15b, d1, e2b, g1b, i1, i2, pss_fr, pcs, mcs, cesd, treat`.
* determine whether you want to provide parametric or non-parametric stats - based on your determination of normality assumptions, sample size considerations, appropriateness of the statistical test and communication with your audience.
* include the appropriate statistical test comparing the group measurements and subject characteristics at baseline
* write a statistical methods section describing (and explaining to your readers) the methods you used to create Table 1 and why you choose those methods to make the comparisons between the groups
* write 1-2 paragraphs (as the beginning of a results section) describing the sample overall at baseline and by group (use the data you presented in Table 1 to help you).
## Report Template for Homework 03
See the WORD document template `N736Homework03_Template.docx` you can download from [https://github.com/melindahiggins2000/N736/raw/master/N736Homework03_Template.docx](https://github.com/melindahiggins2000/N736/raw/master/N736Homework03_Template.docx) - click "Download".
## Variables in HELP dataset to be used for Homework 03
```{r, echo=FALSE, message=FALSE, warning=FALSE}
helpdata <- readRDS("helpmkh.rds")
library(tidyverse)
sub1 <- helpdata %>%
select(age,female,racegrp,homeless,a15a,
a15b,d1,e2b,g1b,i1,i2,pcs,mcs,
cesd,treat,pss_fr)
# create a function to get the label
# label output from the attributes() function
getlabel <- function(x) attributes(x)$label
# getlabel(sub1$age)
library(purrr)
ldf <- purrr::map_df(sub1, getlabel) # this is a 1x15 tibble data.frame
# t(ldf) # transpose for easier reading to a 15x1 single column list
# using knitr to get a table of these
# variable names for Rmarkdown
library(knitr)
knitr::kable(t(ldf),
col.names = c("Variable Label"),
caption="Use these variables from HELP dataset for Homework 03")
```