ftable()
, short for "flatten table," is a function in R that creates a flat contingency table.
ftable(x, ...)
The ftable()
function takes the parameter value x, ...
. This represents R objects that can be interpreted as a list or a factor.
# cretaing R objectsa = c("AAA", "AAA", "BBB", "AAA", "AAA", "CCC", "BBB", "BBB", "AAA")b = c("yyy", "yyy", "qqq", "yyy", "qqq", "iii", "yyy", "qqq", "iii")c = c("___", "###", "___", "___", "###", "___", "___", "###", "???")# implementing the ftable() functionmytable <- ftable(a, b, c)# printing the tablemytable
a
, b
, and c
.ftable()
function to create a flattened table of the R objects. The result is assigned to a variable, mytable
.mytable
variable.