uniques {Transition}R Documentation

Unique Values for Subject, Timepoint and Result

Description

uniques() identifies unique values for subjects, timepoints and test results in longitudinal study data.

Usage

uniques(
  object,
  subject = "subject",
  timepoint = "timepoint",
  result = "result"
)

Arguments

object

a data.frame (or object coercible by as.data.frame() to a data frame) containing the data to be analysed.

subject

character, name of the column (of type integer or factor) identifying individual study subjects; default "subject".

timepoint

character, name of the column recording time points (as Dates) of testing of subjects; default "timepoint".

result

character, name of the column (of type ordered factor) recording test results; default "result".

Details

See Transitions details.

Works for subject as either an integer vector or a factor.

Value

A list of three elements

1.

An integer vector or factor of unique subject identifications.

2.

A vector of class Date of unique timepoints in the study.

3.

An ordered factor of unique values for results of the study.

See Also

data.frame, Dates, ordered factor.

Other transitions: PreviousDate, PreviousResult, Transitions

Examples




 ## Continuing example from `add_transitions()`
  # subject, timepoint and result arguments all defaults and required types
  # (native subject is factor)
uniques(Blackmore)
  #
Blackmore <- transform(Blackmore, subject = as.integer(subject))
  # subject now as integer
Blackmore |> str()
uniques(Blackmore)

rm(Blackmore)


[Package Transition version 1.0.0 Index]