Skip to contents

create a data.frame summary for continuous variables

Usage

continuous_summary(
  dat,
  columns = NULL,
  by = character(0),
  hide_grouplabel = TRUE,
  digits = 3
)

Arguments

dat

a data.frame

columns

continuous variables to be summarized. If NULL all continuous variables are summarized.

by

discrete variables to use as groups when summarizing.

hide_grouplabel

if TRUE, group label will not be rendered, only level/value will be rendered.

digits

the desired number of digits after the decimal point

Examples

ft_1 <- continuous_summary(iris, names(iris)[1:4],
  by = "Species",
  hide_grouplabel = FALSE
)
ft_1

Species

N

min.

q1

median

q3

max.

mean

sd

mad

# na

variable: Sepal.Length

setosa

50

4.300

4.800

5.000

5.200

5.800

5.006

0.352

0.297

0

versicolor

50

4.900

5.600

5.900

6.300

7.000

5.936

0.516

0.519

0

virginica

50

4.900

6.225

6.500

6.900

7.900

6.588

0.636

0.593

0

variable: Sepal.Width

setosa

50

2.300

3.200

3.400

3.675

4.400

3.428

0.379

0.371

0

versicolor

50

2.000

2.525

2.800

3.000

3.400

2.770

0.314

0.297

0

virginica

50

2.200

2.800

3.000

3.175

3.800

2.974

0.322

0.297

0

variable: Petal.Length

setosa

50

1.000

1.400

1.500

1.575

1.900

1.462

0.174

0.148

0

versicolor

50

3.000

4.000

4.350

4.600

5.100

4.260

0.470

0.519

0

virginica

50

4.500

5.100

5.550

5.875

6.900

5.552

0.552

0.667

0

variable: Petal.Width

setosa

50

0.100

0.200

0.200

0.300

0.600

0.246

0.105

0.000

0

versicolor

50

1.000

1.200

1.300

1.500

1.800

1.326

0.198

0.222

0

virginica

50

1.400

1.800

2.000

2.300

2.500

2.026

0.275

0.297

0