freq: freq Function Documentation

freqR Documentation

freq Function Documentation

Description

This function computes frequency distributions for a specified variable and optionally groups within the data set. It can provide outputs in data frame or LaTeX format, including confidence intervals.

Usage

freq(
  data,
  v,
  groups = NULL,
  show.na = T,
  print.labels = F,
  output = "data.frame",
  latex.path = NULL,
  latex.fn = NULL,
  latex.align = NULL,
  latex.longtable = F,
  latex.caption = NULL,
  latex.label = "",
  latex.na.rep = "NA",
  latex.escape = T,
  latex.digits = 2
)

Arguments

data

A data frame containing the variables of interest.

v

The variable name for which the frequency distribution is calculated. This does not need to be quoted.

groups

Optional; a variable name or vectors of variable names to group the results by. This does not need to be quoted.

show.na

Logical; if TRUE, NA values are shown. Default is TRUE. Computation always consider NAs to calculate the percentages.

print.labels

Logical; if TRUE, labels are printed in the results. Default is FALSE.

output

Character; specifies output format, either 'data.frame' or 'latex'. Default is 'data.frame'.

latex.path

Character; path to save the LaTeX files. Default is NULL.

latex.fn

Character; file name for the LaTeX output. Default is NULL.

latex.align

Character; alignment for LaTeX columns. Default is NULL.

latex.longtable

Logical; if TRUE, long tables are used for LaTeX output. Default is FALSE.

latex.caption

Character; caption for the LaTeX table. Default is NULL.

latex.label

Character; label for referencing the LaTeX table. Default is ”.

latex.na.rep

Character; representation of NA in LaTeX output. Default is 'NA'.

latex.escape

Logical; if TRUE, special LaTeX characters are escaped. Default is TRUE.

latex.digits

Integer; number of digits after the decimal point in LaTeX output. Default is 2.

Value

A data frame or LaTeX table displaying frequency distributions and related statistics.

Examples

data(survey)
freq(survey, treat, c(educ, gender))


DiogoFerrari/edar documentation built on Dec. 1, 2024, 10:47 p.m.