lavTables | R Documentation |

Frequency tables for categorical variables and related statistics.

```
lavTables(object, dimension = 2L, type = "cells", categorical = NULL,
group = NULL, statistic = "default", G2.min = 3, X2.min = 3,
p.value = FALSE, output = "data.frame", patternAsString = TRUE)
```

`object` |
Either a |

`dimension` |
Integer. If 0L, display all response patterns. If 1L,
display one-dimensional (one-way) tables; if 2L, display two-dimensional
(two-way or pairwise) tables. For the latter, we can change the information
per row: if |

`type` |
If |

`categorical` |
Only used if |

`group` |
Only used if |

`statistic` |
Either a character string, or a vector of character strings
requesting one or more statistics for each cell, pattern or table. Always
available are |

`G2.min` |
Numeric. All cells with a G2 statistic larger than this number
are considered ‘large’, as reflected in the (optional) |

`X2.min` |
Numeric. All cells with a X2 statistic larger than this number
are considered ‘large’, as reflected in the (optional) |

`p.value` |
Logical. If |

`output` |
If |

`patternAsString` |
Logical. Only used for response patterns (dimension = 0L). If |

If `output = "data.frame"`

, the output is presented as a data.frame
where each row is either a cell, a table, or a response pattern, depending on
the `"type"`

argument.
If `output = "table"`

(only for two-way tables),
a list of tables (if `type = "cells"`

) where each list element
corresponds to a pairwise table, or if `type = "table"`

, a single table
(per group). In both cases, the table entries are determined by the
(single) `statistic`

argument.

Joreskog, K.G. & Moustaki, I. (2001). Factor analysis of ordinal variables: A comparison of three approaches. Multivariate Behavioral Research, 36, 347-387.

`varTable`

.

```
HS9 <- HolzingerSwineford1939[,c("x1","x2","x3","x4","x5",
"x6","x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels=FALSE) )
# using the data only
lavTables(HSbinary, dim = 0L, categorical = names(HSbinary))
lavTables(HSbinary, dim = 1L, categorical = names(HSbinary), stat=c("th.un"))
lavTables(HSbinary, dim = 2L, categorical = names(HSbinary), type = "table")
# fit a model
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HSbinary, ordered=names(HSbinary))
lavTables(fit, 1L)
lavTables(fit, 2L, type="cells")
lavTables(fit, 2L, type="table", stat=c("cor.un", "G2", "cor"))
lavTables(fit, 2L, type="table", output="table", stat="X2")
```

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.