Learn R Programming

diffdepprop (version 0.1-9)

data.cp: Creates binary data of a given data set

Description

Binary data are sometimes needed to analyse these data. Data of two situation (e.g. diagnostic tests) with continous outcome are assumed to be given. With the help of the cutpoint for each test, these data can be dichotomise.

Usage

data.cp(dat, col.test1, col.test2, cp.test1, cp.test2)

Arguments

dat
name of the data set you want to be dichotomise
col.test1
number of the column of the first test in the data set, which shall be dichotomised
col.test2
number of the column of the second test in the data set, which shall be dichotomised
cp.test1
cutpoint for the first test
cp.test2
cutpoint for the second test

Value

A matrix containing the two tests with binary data

Examples

Run this code
# create a data set
v1=c(seq(1,10,0.5))
v2=c(seq(2,11,0.5))
n=c(seq(1,19,1))
new=cbind(n,v1,v2)
# cutpoint of the first test is 1.6, of the second test 2.3
result=data.cp(new,2,3,1.6,2.3)

Run the code above in your browser using DataLab