Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CREATING REPORTS WITH R MARKDOWN

Open a new R session and then complete the exercises below in an R Markdown file (.Rmd) to generate a report of your results as either an HTML, WORD, or PDF file. Your report document should consist of three components: program statements (i.e., echo=TRUE), output, and a text narrative.

Feel free to do the following within the setup chunk of your R Markdown file:

1. Load the contents of the “analysis.Rdata” workspace file created in Lesson 9 into your current R session by using the load().

2. Attach the analysis data frame (OPTIONAL).

1. Generate descriptive statistics for all of the variables within the data frame of 381

2.       patients (except patid).  Comments on the results.

3.       {Consider using summary() and sappy().}

4.          a. How many patients in the sample are female?

5.          b. How many patients are Caucasian?

6.          c. How many patients have a hiatal hernia?

7.          d. How many patients in the sample are current smokers?

5. What is the mean, standard deviation, median, and interquartile range for

6.             barretts length?

7. What is the mean, standard deviation, median, and interquartile range for bmi?

8. What is the mean, standard deviation, median, and interquartile range for age at

diagnosis?

8. Determine the proportion of patients in the sample with the characteristics below and

comment on the results in a paragraph. {Consider using prop.table(table()).}

         a. Long-segment barrett length

         b. A BMI in the normal range

         c. Obese

         d. Caucasian

         e. Female

         f. On PPI

         g. A current smoker

         h. An alcohol user

9. Calculate mean barrett length for each level of the following 5 factors separately: obese, gender, race, hh, and dysplasia. {Consider using tapply() or summary() from the Hmisc package.}

a. In a paragraph, discuss how mean barretts seems to differ across the various levels of these factors?

LESSON 10 – CREATING REPORTS WITH R MARKDOWN

4. Answer the following questions: {Consider using prop.table(table()) along with the margin= option for b and c.}

a. What proportion of patients have long-segment barretts and are obese? b. What proportion of long-segment barretts patients happen to be obese? c. What proportion of obese patients happen to have long-segment barretts?

5. Answer the following questions concerning comparisons between short and long segment barretts patients: {Consider using tapply(), by(), or aggregate().}

a. How does the mean bmi differ between the two sbe groups? i. How about the standard deviation?

b. How does the mean age at diagnosis differ between the two sbe groups? i. How about the standard deviation?

c. How does the median pack number of years differ between the two groups? i. How about the interquartile range (IQR)?

d. How does the median hiatal hernia size differ between the two groups? i. How about the interquartile range (IQR)?

Please turn in both your report (HTML, pdf, or WORD) and the .Rmd program file that you used to create it.