View source: R/moeWaveCrosstab3way.R

moe_wave_crosstab_3way | R Documentation |

`moe_wave_crosstab_3way`

returns a tibble containing a weighted crosstab of two variables by a third variable with margin of error.
Use this function when the z-variable indicates different survey
waves for which weights were calculated independently.

```
moe_wave_crosstab_3way(
df,
x,
y,
z,
weight,
remove = c(""),
n = TRUE,
pct_type = "row",
format = "long",
zscore = 1.96,
unwt_n = FALSE
)
```

`df` |
The data source |

`x` |
The independent variable |

`y` |
The dependent variable |

`z` |
The second control variable, uniquely identifies survey waves |

`weight` |
The weighting variable |

`remove` |
An optional character vector of values to remove from final table (e.g. "refused"). This will not affect any calculations made. The vector is not case-sensitive. |

`n` |
logical, if TRUE numeric totals are included. |

`pct_type` |
Controls the kind of percentage values returned. One of "row" or "cell." |

`format` |
one of "long" or "wide" |

`zscore` |
defaults to 1.96, consistent with a 95% confidence interval |

`unwt_n` |
logical, if TRUE it adds a column with unweighted frequency values |

Options include row or cell percentages. The tibble can be in long or wide format. These tables are ideal for use with small multiples created with ggplot2::facet_wrap.

a tibble

```
moe_crosstab_3way(df = illinois, x = sex, y = educ6, z = year, weight = weight)
moe_crosstab_3way(df = illinois, x = sex, y = educ6, z = year, weight = weight, format = "wide")
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.