From the course: Descriptive Healthcare Analytics in R

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding categorical bivariate tests to Table 1

Adding categorical bivariate tests to Table 1 - R Tutorial

From the course: Descriptive Healthcare Analytics in R

Start my 1-month free trial

Adding categorical bivariate tests to Table 1

- [Instructor] Welcome to Chapter 6, Section 4. We are now ready to add Categorical Bivariate Tests to our Categorical Table 1. In this section, I'm first going to load up the MASS package, which does some great things for us. It makes it so you can do a Chi-square and Fisher's exact test, which are Categorical Descriptive Analyses. Then again, I'm going to call up the gtools package and make a macro to automate doing all the test we need in Categorical Table 1. We'll update our Table 1 and take a look at what we find. First, let's start with the Categorical Table. We don't have any variables for the first line, so we will just say NA there. But next, we have Alcohol status. You'll see I merged these cells together. We will only have one p-value for this. Now let's go to R and get that p-value. Alright, we are working with our analytic file so we will skip this read code. And surprise, a new package. The package is MASS, all caps. Case matters a lot in R. We already installed that…

Contents