blk.isConstant: Check Whether a Variable is Constant or Varying Withing...

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

1
2
blk.isConstant(x, id, ind = NULL)
blk.isVarying(x, id, ind = NULL)

Arguments

x

A vector in block-format with respect to id.

id

A valid block-format ID.

ind

A vector of logicals used to filter the values of x.

Value

A logical.

Author(s)

Ben Rich <benjamin.rich@certara.com>

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

benjaminrich/PCSmisc documentation built on May 24, 2019, 5:02 a.m.