Function generates a data frame of the most common statistics such as mean, standard deviation, minimum and maximum grouped by selected argument for numerical variables

table_one(numeric_vars = NULL, groupby, data)

Arguments

numeric_vars

column names of numeric columns of dataframe which we want to use to have table one arguments should be typed as character vector

groupby

element which we want to group by the rest numeric variables but only one grupby element

data

Data frame

Value

returns a list of the most commonly used statistical measures such as mean, standard deviation, minimum and maximum of desired numerical variables

Examples

library("toRpEDA")
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(stats)
table_one(numeric_vars = c("Petal.Length","Petal.Width"), groupby = "Species", data= iris)
#>                               setosa    versicolor     virginica
#> n                                 50            50            50
#> Petal.Length.mean (SD) 1.462 (0.174) 4.260 (0.470) 5.552 (0.552)
#> Petal.Length.min (max) 1.000 (1.900) 3.000 (5.100) 4.500 (6.900)
#> Petal.Width.mean (SD)  0.246 (0.105) 1.326 (0.198) 2.026 (0.275)
#> Petal.Width.min (max)  0.100 (0.600) 1.000 (1.800) 1.400 (2.500)
table_one(groupby = 'Species', data= iris)
#>                               setosa    versicolor     virginica
#> n                                 50            50            50
#> Sepal.Length.mean (SD) 5.006 (0.352) 5.936 (0.516) 6.588 (0.636)
#> Sepal.Length.min (max) 4.300 (5.800) 4.900 (7.000) 4.900 (7.900)
#> Sepal.Width.mean (SD)  3.428 (0.379) 2.770 (0.314) 2.974 (0.322)
#> Sepal.Width.min (max)  2.300 (4.400) 2.000 (3.400) 2.200 (3.800)
#> Petal.Length.mean (SD) 1.462 (0.174) 4.260 (0.470) 5.552 (0.552)
#> Petal.Length.min (max) 1.000 (1.900) 3.000 (5.100) 4.500 (6.900)
#> Petal.Width.mean (SD)  0.246 (0.105) 1.326 (0.198) 2.026 (0.275)
#> Petal.Width.min (max)  0.100 (0.600) 1.000 (1.800) 1.400 (2.500)