connectedness {connectedness} | R Documentation |
connectedness
finds disconnected sets for two-way
classification without interaction. Its output can be used for
plotting and subseting the data.
connectedness(x, y, sort=TRUE, subset=TRUE)
x |
vector, factor1 |
y |
vector, factor2 |
sort |
boolean, sort sets by number of records |
subset |
boolean, fill the subset slot, see details |
x
and y
must be vectors of the same length. Class of
x
and y
need not be factor, however this is the most
common usage.
Only complete cases (via complete.cases
) of x
and
y
are processed i.e. combinations with NA are removed.
List structure of returned value is:
If you work with big datasets, subset=FALSE
might help you in
returning smaller object. However, subset
method can not be
used on such "truncated" object; read also help page of
subset.connectedness
.
In case of many levels print method truncates them to keep print
within getOption("width")
. Use levelsBySet
to get
all levels by set.
A list of class "connectedness" and "list" with the following entries is returned as described in details.
Gregor Gorjanc
Fernando, R. L. and Gianola, D. and Grossman, M. (1983) Identify all connected subsets in a two-way classification without interaction. Journal of Dairy Science, 66:1399-1402
Searle, S.R. (1987) Linear models for unbalanced models. John Wiley and Sons Inc.
plot.connectedness
,
levelsBySet
and
subset.connectedness
; similar functionality is available
in pheno package: connectedSets
and
maxConnectedSet
data(connect) table(connect$group, connect$season) tmp <- connectedness(x=connect$group, y=connect$season) ## Print method tmp print(tmp) print(tmp, digits=2) ## Plot method par(mfrow=c(2, 2)) plot(tmp) plot(tmp, matrix=FALSE, lines=TRUE, col=c("red", "blue"), pointsArg=list(pch=c(15, 19), cex=2), linesArg=list(lwd=2)) plot(tmp, scale=FALSE, lines=TRUE, linesSet=1, linesArg=list(col="black", lwd=2)) plot(tmp, set=2, col=c("gray"), plotArg=list(xlab="Group", ylab="Season")) ## Subset method subset(x=tmp, data=connect, set=1) subset(x=tmp, data=connect, set=2) subset(x=tmp, data=connect, set=c(1, 2)) subset(x=tmp, data=connect) ## levelBySet method levelsBySet(x=tmp) levelsBySet(x=tmp, set=1, factor="x") levelsBySet(x=tmp, set=c(1, 2), factor="y")