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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/PCSmisc.R

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

1
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)

Ben Rich <[email protected]>

See Also

block-format

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 Dec. 17, 2017, 12:50 a.m.