gmData                package:gRbase                R Documentation

_C_l_a_s_s "_g_m_D_a_t_a" _g_r_a_p_h_i_c_a_l _m_e_t_a _d_a_t_a

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

     A common class for representing data. No matter the actual
     representation of data, the important characteristics are
     contained in a graphical metadata object.

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

     newgmData(varNames,
                        varTypes=rep(validVarTypes()[1],length(varNames)),
                        nLevels=NULL,
                        latent=NULL,
                        valueLabels=NULL,
                        observations=NULL,
                        description=NULL,
                        shortNames=NULL
                        )

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

varNames: a vector of strings with names of variables.

varTypes: a vector of strings with values from 'validVarTypes' giving
          the types of the variables; typical types are
          "Discrete","Ordinal","Continuous", but others can be defined.
          The types can be abbreviated.

 nLevels: a numeric vector with integer values for discrete or ordinal
          variables giving the number of levels.

  latent: a vector of strings with names of the latent variables.

valueLabels: a list of vectors of strings with names of the levels for
          each discrete or ordinal variable.

observations: an object containing the observations, eg. a dataframe or
          a table.

description: a string describing the origin of the data.

shortNames: a vector of strings giving a short name of each variable.

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

     If neither nLevels nor valueLabels are given, then all categorical
     variables are assumed to be binary. If valueLabels are given then
     nLevels are infered from these. valueLabels / nLevels are recycled
     if necessary.

_V_a_l_u_e:

     An object of class 'gmData' holds information about the data and
     can be retrieved and changed by accessor functions.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'newgmData( varNames,
     varTypes, nLevels, latent, valueLabels, observations,
     description)'.

     More often, gmData objects will be created from a data.frame or
     table.

     A 'gmData' object contains the abstraction of data into a meta
     data object including variable names and types etc. However, the
     actual data might not be present or may be represented by a
     reference to data, such as a database file. Also, it may be
     possible to work without data, which may be valuable if the point
     of interest is in the model alone. Separating the specification of
     the variables from data has the benefit, that some properties of a
     model can be investigated without any reference to data, for
     example decomposability and collapsibility.

_A_u_t_h_o_r(_s):

     Sren Hjsgaard, sorenh@agrsci.dk, 
      Claus Dethlefsen, dethlef@math.aau.dk

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

     'demo(gmData)'

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

     vn <- c("a","b","c","d")
     z<-newgmData(vn,varTypes=c("dis","dis","con","con"))
     summary(z)
     z<-newgmData(vn,varTypes=c("dis","dis","con","con"),nLevels=c(4,3,NA,NA))
     summary(z)
     z<-newgmData(vn,varTypes=c("dis","dis","con","con"),nLevels=c(4,NA,NA,NA))
     summary(z)
     z<-newgmData(vn,varTypes=c("dis","dis","ord","con"),valueLabels=list("a"=1:2, "b"=1:4))
     summary(z)

     ccnames <- c("asia", "smoke", "tub", "lung", "bronc", "either", "xray", "dysp")
     gmd <- newgmData(ccnames,valueLabels=c("yes","no"), description="Chest clinic")
     summary(gmd)

     data(mathmark)
     as.gmData(mathmark)

     data(HairEyeColor)
     as.gmData(HairEyeColor)

