Skip to contents

To make a table, you can use the omni_table() function. This function takes two arguments, the data (which is usually piped into the function as seen below) and a name for the table.

mtcars  |>  
  # This is used because the `mtcars` data frame uses 
  # row names and we want to convert these into a variable
  rownames_to_column(var = "car") |> 
  slice(1:5) |> 
  omni_table()

car

mpg

cyl

disp

hp

drat

wt

qsec

vs

am

gear

carb

Mazda RX4

21.0

6

160

110

3.90

2.620

16.46

0

1

4

4

Mazda RX4 Wag

21.0

6

160

110

3.90

2.875

17.02

0

1

4

4

Datsun 710

22.8

4

108

93

3.85

2.320

18.61

1

1

4

1

Hornet 4 Drive

21.4

6

258

110

3.08

3.215

19.44

1

0

3

1

Hornet Sportabout

18.7

8

360

175

3.15

3.440

17.02

0

0

3

2

The table will be created based on whatever data you pipe into the omni_table() function. So, for example, if you wanted to only include certain variables, you could do as follows:

mtcars %>% 
  rownames_to_column(var = "car") |> 
  slice(1:5) |> 
  select(car, mpg, hp) |> 
  omni_table()

car

mpg

hp

Mazda RX4

21.0

110

Mazda RX4 Wag

21.0

110

Datsun 710

22.8

93

Hornet 4 Drive

21.4

110

Hornet Sportabout

18.7

175