blk.isConstant | R Documentation |
This function checks whether a variable is constant or varying
withing blocks of a block-format
data set. A variable
is constant if it takes the same value at each position within a
block. It is varying if it takes more than one distinct value
within a block.
blk.isConstant(x, id, ind = NULL)
blk.isVarying(x, id, ind = NULL)
x |
A vector in |
id |
A valid |
ind |
A vector of logicals used to filter the values of |
A logical.
Benjamin Rich <mail@benjaminrich.net>
block-format
blk.applyNto1
nunique
require(nlme)
data(Phenobarb)
dat <- Phenobarb[1:56,] # First 4 subjects
attach(dat)
blk.isConstant(Wt, asID(Subject)) # TRUE
blk.isConstant(Apgar, asID(Subject)) # TRUE
blk.isConstant(dose, asID(Subject)) # FALSE
blk.isConstant(dose, asID(Subject), ind=(!is.na(dose) & time > 0)) # TRUE
detach(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.