summarize_table.Rd
This function provides a summary of each column in a data frame, generating different statistics based on the type of data (numeric, factor, character, logical, or other). It returns a tibble with the variable names and associated summary statistics, categorized by their data type.
summarize_table(df)
A tibble with summary statistics for each variable in the input data frame. The summary includes:
The data type of the variable (Numeric, Factor, Character, Logical, Other).
The mean of the numeric variables (if applicable).
The median of the numeric variables (if applicable).
The standard deviation of the numeric variables (if applicable).
The minimum value of the numeric variables (if applicable).
The maximum value of the numeric variables (if applicable).
The number of levels for factor variables (if applicable).
The number of unique values for character or factor variables.
The most frequent value for character or factor variables.
The frequency of the most common value for character or factor variables.
The number of TRUE values for logical variables.
The number of FALSE values for logical variables.
The number of missing values for each variable.
summarize_table(mtcars)
#> # A tibble: 11 × 8
#> Variable Type Mean Median SD Min Max NA_Count
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
#> 1 mpg Numeric 20.1 19.2 6.03 10.4 33.9 0
#> 2 cyl Numeric 6.19 6 1.79 4 8 0
#> 3 disp Numeric 231. 196. 124. 71.1 472 0
#> 4 hp Numeric 147. 123 68.6 52 335 0
#> 5 drat Numeric 3.60 3.70 0.535 2.76 4.93 0
#> 6 wt Numeric 3.22 3.32 0.978 1.51 5.42 0
#> # ℹ 5 more rows