| represent.long | R Documentation | 
Long representation of results from two binary diagnostic tests.
represent.long(d, y1, y2)
d | 
 A numeric vector specifying the gold-standard results (1 = presence of disease, 0 = absence of disease).  | 
y1 | 
 A numeric vector specifying the results of diagnostic test 1 (1 = positive, 0 = negative).  | 
y2 | 
 An numeric vector specifying the results of diagnostic test 2 (1 = positive, 0 = negative).  | 
Sometimes a long representation of data from a “paired” study of binary diagnostic tests is required, e.g. to run regression analyses.
In a wide representation each subject has 1 record in the dataset containing d, y1 and y2.
In a long representation each subjects has 2 records in the dataset, one for each test. The data format is shown below.
A dataframe containing:
id | 
 A numeric vector specifying the patient identifier.  | 
d | 
 A numeric vector specifying the gold-standard results (1 = presence of disease, 0 = absence of disease).  | 
x | 
 A numeric vector specifying the diagnostic test (1 = test 1, 0 = test 2).  | 
y | 
 A numeric vector specifying the test results (1 = positive, 0 = negative).  | 
tab.paired and read.tab.paired.
data(Paired1) # Hypothetical study data
names(Paired1)
new.long <- represent.long(d=Paired1$d, y1=Paired1$y1, y2=Paired1$y2)
str(new.long)
head(new.long)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.