read_data: read_data

Description Usage Arguments Details Value Examples

Description

Read data from the data file that contains the trait data, haplotypes, and the probability of the haplotype pair occurring in the population.

Usage

1
read_data(path = getwd(), file = NULL, csv = FALSE)

Arguments

path

a character vector containing the absolute path for where the phenotype file is located. The default is that the data file is contained in the directory from which R is being run.

file

a character vector containing the name of the data file.

csv

a logical value. When TRUE, a csv file format is assumed. When FALSE, a space separated format is assumed. The default is for the file to be space separaed.

Details

Here, read_data reads in the ASCII data into the package. A space separated ASCII file with column headings is assumed. A csv file can also be read if csv is set to TRUE. Each row of the data file is the data for a seperate animal. The data file is allowed to have any number of columns.

Four columns are mandatory in order for hapsampler to function correctly; a column with the trait data, two columns with the haplotypes, and a column with the haploytpe probabilities. The trait column can be named anything but the columns with the haplotypes and their probability must be named hap1, hap2, and prob, respectively.

The columns hap1 and hap2 contain the haplotype indexes. These indexes can be any integer number.

Missing data are not allowed.

Value

a data frame is returned of the data. The names of the columns will be as specified by the first row of the data file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    # Read in  example phenotypic data from ./inst/extdata/
    
    # finding the full location of the phenotypic data
    complete.name <- system.file("extdata", "dataexample.dat", package="HapSampler")
    
    # read in phenotypic data which is in csv format
    dt <- read_data(path=dirname(complete.name),
                                 file=basename(complete.name))
    
     ## print a couple of lines of the data file
     head(dt)

geo047/HapSampler documentation built on May 17, 2019, 1:11 a.m.