as methods in adegenet       package:adegenet       R Documentation

_C_o_n_v_e_r_t_i_n_g _g_e_n_i_n_d/_g_e_n_p_o_p _o_b_j_e_c_t_s _t_o _o_t_h_e_r _c_l_a_s_s_e_s

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

     These S3 and S4 methods are used to coerce genind and genpop
     objects to matrix-like objects. In most cases, this is equivalent
     to calling the '@tab' slot. An exception to this is the convertion
     to 'ktab' objects used in the ade4 package as inputs for K-tables
     methods (e.g. Multiple Coinertia Analysis).

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

     'as(object, Class)'

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


     '_o_b_j_e_c_t' a genind or a genpop object.

     '_C_l_a_s_s' the name of the class to which the object should be
          coerced, for instance '"data.frame"' or '"matrix"'.

_M_e_t_h_o_d_s:


     _c_o_e_r_c_e from one object class to another using
          'as(object,"Class")', where the 'object' is of the old class
          and the returned object is of the new class '"Class"'.

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

     Thibaut Jombart t.jombart@imperial.ac.uk

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

     data(microbov)
     x <- na.replace(microbov,method="0")
     as(x[1:3],"data.frame")

     ## dudi functions attempt to convert their first argument
     ## to a data.frame; so they can be used on genind/genpop objects.
     if(require(ade4)){
     ## perform a PCA
     pca1 <- dudi.pca(x, scale=FALSE, scannf=FALSE)
     pca1

     x <- genind2genpop(microbov,miss="chi2")
     x <- as(x,"ktab")
     class(x)
     ## perform a STATIS analysis
     statis1 <- statis(x, scannf=FALSE)
     statis1
     plot(statis1)
     }

