Frequency table for continuous data

bs_freq_table_cont(
  y,
  nbins = NULL,
  bin_width = NULL,
  xmin = NULL,
  xmax = NULL,
  max_bin_decimals = 2,
  percent_decimals = 1,
  right = TRUE
)

# S3 method for bs_freq_table_cont
pander(
  x,
  ...,
  caption = "Frequency table",
  justify = c("crrrr"),
  style = "simple"
)

Arguments

y

(numeric) A numeric vector with data.

nbins

(integer) Number of bins.

bin_width

(number) Bin width.

xmin

(number) Lower position of the lowest bin. Not bigger than min(x).

xmax

(number) Upper position of the highest bin. Not smaller than max(x).

max_bin_decimals

(integer) Maximum number of significant decimal digits to display in bin names.

percent_decimals

(integer) Number of decimal numbers in percentages.

right

(logical) Flag that indicates if the intervals should be closed on the right and open on the left (default) or vice versa.

x

object to print

...

further arguments to methods

caption

(string) caption

justify

(string) Column justification

style

(string) the name of style for table.

Value

Object of classes bs_freq_table_cont, data.frame.

Examples

library(biostat) library(pander) bs_freq_table_cont(iris$Sepal.Length, nbins = 5)
#> Bin Freq Cum_freq Percent Cum_percent #> 1 4.3 -- 5.0 32 32 21.3 % 21.3 % #> 2 5.0 -- 5.7 41 73 27.3 % 48.7 % #> 3 5.7 -- 6.5 42 115 28.0 % 76.7 % #> 4 6.5 -- 7.2 24 139 16.0 % 92.7 % #> 5 7.2 -- 7.9 11 150 7.3 % 100.0 %
bs_freq_table_cont(iris$Sepal.Length, bin_width = 1, xmin = 4)
#> Bin Freq Cum_freq Percent Cum_percent #> 1 4 -- 5 32 32 21.3 % 21.3 % #> 2 5 -- 6 57 89 38.0 % 59.3 % #> 3 6 -- 7 49 138 32.7 % 92.0 % #> 4 7 -- 8 12 150 8.0 % 100.0 %
bs_freq_table_cont(iris$Sepal.Length, nbins = 5) %>% pander()
#> #> #> Bin Freq Cum_freq Percent Cum_percent #> ------------ ------ ---------- --------- ------------- #> 4.3 -- 5.0 32 32 21.3 % 21.3 % #> 5.0 -- 5.7 41 73 27.3 % 48.7 % #> 5.7 -- 6.5 42 115 28.0 % 76.7 % #> 6.5 -- 7.2 24 139 16.0 % 92.7 % #> 7.2 -- 7.9 11 150 7.3 % 100.0 % #> #> Table: Frequency table #>
# [!!!BLOGAI]: # bs_freq_table_cont(iris$Sepal.Length, bin_width = 5, xmax = 10)