Sort a Data Frame by Specified Variables and Provide Record IDs

DESCRIPTION:

Returns a sorted data frame and adds integer variables clusterID , replicateID , recordID .

USAGE:

recordDesign(cluster,data,record) 

REQUIRED ARGUMENTS:

cluster
a character vector of named variables (columns) in data identifying the cluster variable or variables (in order). Observations within a cluster may be correlated, and records from different clusters are not correlated.
data
a data frame containing the variables in cluster and in record.

OPTIONAL ARGUMENTS:

record
a character vector of named variables (columns) in data. The data are grouped according to cluster, and the ordering within clusters is determined by the order of the variable names in record. Variables in record may be either categorical or numeric, although numeric variables are considered discrete for the purposes of grouping. If record is not specified, data is sorted by cluster, and the default recordID for a cluster is a vector of integers from 1 to the size of the cluster.

VALUE:

An object of class "recordDesign", which is a data frame grouped according to cluster and ordered within clusters as specified in record . Three additional integer variables are appended to the data frame:

clusterID
Assign aunique integer to each cluster in the order determined by argument cluster.
replicateID
Assigns a unique integer to replicates within clusters in the order determined by argument record.
recordID
Assigns a unique integer identifying records within clusters in the order determined by argument record and (if there are replicates in a cluster) the original order of the data.
observationID
Assigns a unique integer to each observation corresponding to its postition in the orginal data set.

Arguments cluster and record ) are appended to the data frame. There are "cluster" and "record" attributes which give the corresponding arguments to recordDesign .

DETAILS:

This function is used for correlated data to create a mapping for cluster and record identification.
Use summary to see a complete cluster.
A warning is issued whenever replicateID and recordID are unequal, indicating that the record specification is not sufficient to produce distinguishable records within clusters.
The variables in cluster must be distinct from variables in record.
Variables in cluster or record may be either categorical or numeric, although numeric variables are considered discrete for the purposes of grouping.

SEE ALSO:

, , .

EXAMPLES:

recordDesign(cluster="Dog",data=Pixel)
recordDesign(cluster="Dog",data=Pixel,record="Side")
recordDesign(cluster="Dog",data=Pixel,record="day")
recordDesign(cluster="Dog",data=Pixel,record=c("Side","day"))
recordDesign(cluster=c("Dog","Side"),data=Pixel,record="day")