| p_table | R Documentation |
A wrapper function for table(), with support for piping.
p_table(data, x, y = NULL, ...)
data |
the data |
x |
one variable |
y |
another variable |
... |
additional arguments passed to |
a table object
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.