View source: R/percentile_table.R
percentile_table | R Documentation |
Function locates values corresponding to percentiles in a vector of numeric data. Function displays a table with lower/upper locations, values, average and spread between lower/upper from median to one hundred and twenty-eighth percentiles. The function returns a list with a viewable gt table along with the data.table containing the table's values.
The "label" column of the table correspond to the following percentiles:
"M" = Half (i.e. the median)
"F" = Fourth (i.e. quartiles 25/75)
"E" = Eighth
"D" = Sixteenth
"C" = Thirty-secondth
"B" = Sixty-fourth
"A" = One hundred and twenty-eighth
percentile_table(vals = NULL, na_rm = TRUE, title = NULL, table_width = NULL)
vals |
A required vector of numeric values |
na_rm |
A logical which if TRUE removes NA values before the calculations |
title |
A string that sets the table's title. The string can contain R markdown/html style syntax. |
table_width |
A numeric that sets the overall table width in pixels. |
A named list with a gt object and a data.table with percentile values contained in the display table.
library(gt)
library(data.table)
library(RplotterPkg)
set.seed(12345)
random_vals <- stats::rnorm(n = 1000, mean = 20, sd = 4)
percentile_random_lst <- RplotterPkg::percentile_table(
vals = random_vals
)
percentile_random_lst$table_gt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.