returnNcells {CoCoRaw}R Documentation

Return the number of cells in a table

Description

Return the number of cells in the table formed by the cross classification according to a given set of discrete variables.

Usage

returnNcells(set = "*", full = FALSE, total = FALSE, data = NULL, 
             object = .object.of.thing(data = data, ...), ...)

Arguments

set A character string with a set of discrete variables.
full Logical, if full is TRUE then all specified variables (setUseVariables) are considered.
total Logical, if total is TRUE then also missing levels (excludeMissing) are counted.
data See exportCoCo.
object See exportCoCo.
... Additional arguments to generate the CoCo object from the data argument. See propertyModel.

Value

An integer.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames, setUseVariables and excludeMissing.

Examples


library(CoCo)
data(Hochberg77)
ftable(Hochberg77, col.vars=4:6)

# Without "data" require ending the CoCo object:

# returnNcells(data = Hochberg77);
# endCoCo();

# With CoCo object:

CoCoObject <- makeCoCo();

enterTable(Hochberg77, missing = c(1, 1, 0, 0, 0, 0), object = CoCoObject);

showOptions("specification", object = CoCoObject)

returnNcells(object = CoCoObject);

# With only a subset:

missing <- c(1, 1, 0, 0, 0, 0);
enterNames(names(dimnames(Hochberg77)), 
           levels = dim(Hochberg77) - missing,
           missing = missing, CoCoObject);

setUseVariables("bcdef.", object = CoCoObject)

enterTable(c(Hochberg77), object = CoCoObject);

showOptions("specification", object = CoCoObject)

returnNcells(object = CoCoObject);

returnNcells(set = "abc", object = CoCoObject);

returnNcells(set = "bc.", full = FALSE, total = FALSE, object = CoCoObject);
returnNcells(set = "bc.", full = FALSE, total = TRUE,  object = CoCoObject);
returnNcells(set = "abc.", full = TRUE,  total = FALSE, object = CoCoObject);
returnNcells(set = "abc.", full = TRUE,  total = TRUE,  object = CoCoObject);

excludeMissing("in", set = "bc.", object = CoCoObject);

returnNcells(set = "bc.", full = FALSE, total = FALSE, object = CoCoObject);
returnNcells(set = "bc.", full = FALSE, total = TRUE,  object = CoCoObject);
returnNcells(set = "abc.", full = TRUE,  total = FALSE, object = CoCoObject);
returnNcells(set = "abc.", full = TRUE,  total = TRUE,  object = CoCoObject);

endCoCo(object = CoCoObject);

# With continuous:

library(CoCoCg);
data(Rats);
CoCoObject <- makeCoCoCg();
enterDataFrame(Rats, object = CoCoObject);
returnNcells(set = "ab;", object = CoCoObject);
returnNcells(object = CoCoObject); 

endCoCo(object = CoCoObject);


[Package CoCoRaw version 0.1.7.4 Index]