% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/p_table.r
\name{p_table}
\alias{p_table}
\title{Tables variables, with support for piping}
\usage{
p_table(data, x, y = NULL, ...)
}
\arguments{
\item{data}{the data}

\item{x}{one variable}

\item{y}{another variable}

\item{...}{additional arguments passed to \code{\link[=table]{table()}}.}
}
\value{
a \code{table} object
}
\description{
A wrapper function to \code{table()}, with support for piping.
}
\examples{
# load the data
data(nhanes)

# define smoking
nhanes<-nhanes |> transform(
  smoking=base_match(smq020,'No'=2,'History of smoking'=1)
)

# define asthma
nhanes<-nhanes |> transform(
  asthma=base_match(mcq010,'Asthma'=1,'No'=2)
)

# table smoking
nhanes |> p_table(smoking)

# table smoking and asthma
nhanes |> p_table(smoking,asthma)
}
