% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/table_prop.R
\name{table_prop}
\alias{table_prop}
\title{Frequencies and proportions in one output}
\usage{
table_prop(..., margin = NULL, round = 3, noquote = FALSE)
}
\arguments{
\item{...}{Arguments passed to \code{base::table()}.}

\item{margin}{Integer 1L. The same argument as in base::prop.table()}

\item{round}{Integer 1L. Number of digits after decimal in base::prop.table() output}

\item{noquote}{Logical 1L. If TRUE, return an object of class noquote that provides better view of the output}
}
\value{
Matrix or noquote matrix. Frequencies with proportions in brackets, within a matrix
}
\description{
Combines base::table() and base::prop.table() outputs in a single one
}
\examples{
df <- data.frame(
                 "variable_1" = c("v1_1", "v1_1",
                                  "v1_2", "v1_2", "v1_2", "v1_2"),
                 "variable_2" = c("v2_1", "v2_1", "v2_1", "v2_1",
                                  "v2_2", "v2_2")
                                  )
table_prop(df$variable_1)
table_prop(df$variable_1, df$variable_2)
table_prop(df$variable_1, df$variable_2, margin = 2, noquote = TRUE)
df <- data.frame("person_id" = c(1, 1, 2, 3,
                                 2, 4, 5, 5 ,1),
                 "person_age" = c(25, 25, 21, 32,
                                  21, 48, 50, 50, 52),
                 "survey_month" = c("jan", "feb", "mar", "apr",
                                    "apr", "may", "jun", "jul", "jan"),
                 "survey_answer" = c("no", "yes", "no", "yes",
                                     "yes", "yes", "no", "yes", NA))

table_prop(df$survey_month)
table_prop(df$survey_month, df$survey_answer)
table_prop(df$survey_month, df$survey_answer, 
           margin = 2, round = 4)
}
