Learn R Programming

Comp2ROC (version 1.1.4)

read.file: Read data from file

Description

This function allows to read data from a file.

Usage

read.file(name.file.csv, header.status = TRUE, separator = ";", decimal = ",", modality1, testdirection1, modality2, testdirection2, status1, related = TRUE, status2 = NULL)

Arguments

name.file.csv
Name of the file with data. The file must be in csv or txt format
header.status
Indicates if the file has a header row
separator
Indicates what is the column separator
decimal
Indicates what is the decimal separator
modality1
Name of the column of dataframe that represents the first modality
testdirection1
Indicates the direction of the test for modality 1. If TRUE means that larger test results represent more positive test
modality2
Name of the column of dataframe that represents the second modality
testdirection2
Indicates the direction of the test for modality 2. If TRUE means that larger test results represent more positive test
status1
Name of the column of dataframe that represents the Status 1
related
Boolean parameter that represents if the two modalities are related or not
status2
Name of the column of dataframe that represents the Status 2

Value

This functions returns a list with the following data:
sim1.ind
Vector with the data for Curve 1
sim2.ind
Vector with the data for Curve 2
sim1.sta
Vector with the status for Curve 1
sim2.sta
Vector with the status for Curve 2

Details

The default column separator is ";". And the default decimal separator is ".". header.status has also a default value that is TRUE. By default, the related parameter is set to TRUE. In this case the status2 is not necessary (by default set to (NULL), because in related modalities the status is the same. Otherwise, if related is set to FALSE, its necessary to indicate the name of status2 column. In the data must be listed first all values of the distribution of negative cases (0), followed by the positive ones (1).

See Also

read.manually.introduced

Examples

Run this code
# This is a simple example how to read a file:

data.filename = "zhang.csv"
modality1DataColumn = "modality1"
modality2DataColumn = "modality2"
modality2StatusHeader = "status"  # if different from modality1's header
                                  # (a.k.a they are independent)
zhang = read.file(data.filename, TRUE, ";", ".", modality1, TRUE, modality2, TRUE, "status")

Run the code above in your browser using DataLab