subset.connectedness {connectedness} | R Documentation |
subset.connectedness
helps you to subset data based on
disconnected sets.
subset.connectedness(x, data, ..., set=NULL, dropNA=NULL)
x |
connectedness, output from connectedness |
data |
data.frame, data |
... |
arguments passed to subset.data.frame |
set |
integer, set number(s), see details |
dropNA |
boolean, drop sets with missing levels, see details |
set
defines which sets of records will stay in output of this
function. If set=NULL
"all" records will be returned. If there
were any NA's in a call of connectedness
, not exactly all
reccords will be returned here because connectedness
excludes records with NA's (subject to change/improve in future).
If subset slot in x
is NULL, the following error is issued
"subset slot is empty". This is due to the use of argument
subset=FALSE
in connectedness
. You will have to
rerun connectedness
with subset=TRUE
to overcome
this issue.
Argument dropNA
can be used to remove data.frame rows that have
unused levels for either factor that was used in
connectedness
. By default value is taken from object
x
.
Data.frame with records that correspond to defined sets in set
.
Gregor Gorjanc
connectedness
, levelsBySet
,
plot.connectedness
and subset
data(connect) table(connect$group, connect$season) tmp <- connectedness(x=connect$group, y=connect$season) tmpD <- connectedness(x=connect$group, y=connect$season, drop=TRUE) ## Subset method subset(x=tmp, data=connect) subset(x=tmpD, data=connect) subset(x=tmp, data=connect, dropNA=TRUE) subset(x=tmp, data=connect, set=1) subset(x=tmp, data=connect, set=2) subset(x=tmp, data=connect, set=c(1, 2))