sample_sizes | R Documentation |
This functions binds individual numeric values (representing sample sizes) into a printable table. It is a follow-up function for save_n
which extracts the number of cases in a data frame.
sample_sizes(..., sample = c("All cases", "Eligible cases",
"Complete cases"), digits = 1, print = FALSE)
... |
Several numeric values representing sample sizes (e.g., obtained by using |
sample |
Names for the rows in the final table. |
digits |
Number of digits that should be print (only in combination with |
print |
Logical value indicating whether the output should be formatted to fit APA-guidelines (transform varibales to character vectors). |
An object of class tbl_df
that can be passed to apa_table
. It contains all sample sizes that were provided as individual numeric values.
# Simple example
sample_sizes(100, 80, 10, print = TRUE)
# Realistic example
d <- mtcars
d1 <- d[1:28,]
d2 <- d1[1:20,]
n0 <- save_n(d)
n1 <- save_n(d1)
n2 <- save_n(d2)
sample_sizes(n0, n1, n2)
sample_sizes(n0, n1, n2,
sample = c("Sample 1",
"Sample 2",
"Sample 3"),
digits = 3,
print = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.