phe                  package:pbatR                  R Documentation

_P_h_e_n_o_t_y_p_e _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Creates, tests, reads, or writes an object of class 'phe'.

_U_s_a_g_e:

     as.phe( df, pid="pid", id="id" )

     is.phe( obj )

     read.phe( filename, na.strings=c("-",".","NA"), lowercase=TRUE,
               sym=TRUE, ... )

     write.phe( file, phe )

     ## S3 method for class 'phe':
     sort(x,decreasing=FALSE,...)

_A_r_g_u_m_e_n_t_s:

      df: Dataframe with the data

     pid: String for the column header for 'pid' - pedigree ID.

      id: String for the column header for 'id' - subject ID.

     obj: any object

filename: Filename to open; does not need .phe extension.

na.strings: Strings that represent NA; defaults should be fine here.

lowercase: When TRUE (default), enforces all headers to lowercase for
          convenience.

     sym: When TRUE, only the header of the file is read in; only PBAT
          will load in the file (* - see exception).  When FALSE, the
          entire file will be read in, and can be modified before using
          with PBAT.

     ...: Options for 'read.table'.  Do _not_ put in 'header=TRUE', as
          this will cause an error, as the header is automatically
          loaded.

          With the proper file formatting, this should not be used. 

    file: string representing filename, or a connection for file output

     phe: An object of class 'phe' (see 'as.phe').

       x: An object of class 'phe' (see 'as.phe').

decreasing: Whether to sort in decreasing/increasing order.

_D_e_t_a_i_l_s:

     When reading in a file on disk using 'read.ped', a `.phe' file
     should have the following format (taken from the PBAT web-page). 
     The first line contains  the names of the covariates and
     phenotypes and the subsequent lines contain the pedigree id, the
     id of the subject, followed by the values of the covariates and
     phenotypes for that subject.  Here missing values must be indicate
     with a `.' or `-', unlike the pedigree file. Examples of this type
     of file can be found on the PBAT webpage.

     Once the dataset is read in, missing values are converted into the
     usual R format of NA (see NA in the help files).

     When using 'as.phe', missing values should be in the native R
     format. The 'write.ped' function will convert back into the
     missing format necessary for PBAT.

     (*) Exception. If symbolic is true, the dataset will be
     temporarily read in under one special circumstance.  This is when
     a stratification variable is used in pbat.m, pbat.obj, or
     pbat.files.  This is because the grouping values must be read in. 
     Alternatively, you can specify these values when calling those
     functions (see the groups.* options) in pbat.

_N_o_t_e:

     *`read.phe' mild warning*: This function _might change the names
     of headers_, so they may not correspond to what pbat is looking
     for if you call any of  the pbat*files() commands (_even_ if
     lowercase=FALSE, as some symbols might be modified by R naming
     conventions).  In general this should not happen.

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.biostat.harvard.edu/~clange/default.htm>

     <URL: http://www.people.fas.harvard.edu/~tjhoffm/pbatR.html>

_S_e_e _A_l_s_o:

     'read.ped',  'write.ped', 'as.ped', 'as.pedlist'

_E_x_a_m_p_l_e_s:

     # A highly artificial example just to get you used to the syntax
     #  of using 'as.phe'.
     x <- data.frame( pid    = c(1,1,2,2,2),
                      id     = c(1,2,3,4,5),
                      age    = c(14,45,33,22,21),
                      weight = c(150,100,180,185,110) )
     x
     myPhe <- as.phe( x );
     myPhe

     # And just another e.g. capitalizing on prior code
     names(x)[1:2] <- c("thepid","theid")
     x
     myPhe <- as.phe( x, pid="thepid", id="theid" )
     myPhe  # same as before!

