Avance para o conteúdo

Constrói uma tabela com distribuição de frequências brutas, relativas e acumuladas, com rótulos em português

Usage

tabuleiro(
  x,
  digits = 1,
  total = TRUE,
  cum = TRUE,
  format = "en",
  data = NULL,
  ...
)

Argumentos

x

O vetor a ser tabulado

digits

nº de decimais na tabela

total

TRUE (default) apresenta o total de categorias na tabela

cum

TRUE (default) apresenta as frequências acumuladas das cateogrias

format

Caráter indicando se o formato da tabela é anglo-saxão ("en", default) ou latino ("pt"); se "pt", os decimais serão apresentados depois de vírgula e os milhares separados por ponto # NÃO IMPLEMENTADO – COLOCAR ISSO NUM MÉTODO PRINT.tabuleiro

data

Optional argument. Data frame containing x. Defaults to NULL

...

permite o uso de argumentos da função table

Exemplos

set.seed(1)
x <- rbinom(100000, 3, .25)

tabuleiro(x)
#>         Freq     % Freq.acum %acum
#> 0      42221  42.2     42221  42.2
#> 1      42127  42.1     84348  84.3
#> 2      14003  14.0     98351  98.4
#> 3       1649   1.6    100000 100.0
#> Total 100000 100.0    100000 100.0

# Sem o total
tabuleiro(x, total = FALSE)
#>    Freq    % Freq.acum %acum
#> 0 42221 42.2     42221  42.2
#> 1 42127 42.1     84348  84.3
#> 2 14003 14.0     98351  98.4
#> 3  1649  1.6    100000 100.0

# Sem as frequências acumuladas
tabuleiro(x, cum = FALSE)
#>         Freq     %
#> 0      42221  42.2
#> 1      42127  42.1
#> 2      14003  14.0
#> 3       1649   1.6
#> Total 100000 100.0

# Oculta a frequência acumulada absoluta e mantém a % acumulada
tabuleiro(x, total = FALSE)[,-3]
#>    Freq    % %acum
#> 0 42221 42.2  42.2
#> 1 42127 42.1  84.3
#> 2 14003 14.0  98.4
#> 3  1649  1.6 100.0