asID: Make a Valid Block Format ID From One or More Vectors

View source: R/PCSmisc.R

asIDR Documentation

Make a Valid Block Format ID From One or More Vectors

Description

A block-format ID is constructed from one or more atomic vectors. If more than one atomic vector is supplied, then a compound ID is constructed by concatenating the values together.

Usage

asID(id, ..., sep="|")

Arguments

id

An atomic vector.

...

More atomic vectors.

sep

A character to use as a separator when forming a compound ID.

Value

A valid block format ID, i.e. a factor x such that is.unsorted(x) is FALSE.

Author(s)

Benjamin Rich <mail@benjaminrich.net>

See Also

block-format

Examples

require(nlme)
data(Phenobarb)
dat <- Phenobarb[1:56,]  # First 4 subjects

attach(dat)

is.unsorted(Subject)           # TRUE  - the original column is NOT sorted
is.unsorted(asID(Subject))     # FALSE - the ID is sorted

all(as.character(Subject) == as.character(asID(Subject)))  # TRUE - textually they are the same

cbind(ID=asID(Subject), dat)

detach(dat)

benjaminrich/PCSmisc documentation built on Feb. 11, 2024, 9:25 p.m.