makefreq           package:adegenet           R Documentation(utf8)

_F_u_n_c_t_i_o_n _t_o _g_e_n_e_r_a_t_e _a_l_l_e_l_i_c _f_r_e_q_u_e_n_c_i_e_s

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

     The function 'makefreq' generates a table of allelic frequencies
     from an object of class 'genpop'.

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

     makefreq(x,quiet=FALSE,missing=NA,truenames=TRUE)

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

       x: an object of class 'genpop'.

   quiet: logical stating whether a conversion message must be printed
          (TRUE,default) or not (FALSE).

 missing: treatment for missing values. Can be NA, 0 or "mean" (see
          details)

truenames: a logical indicating whether true labels (as opposed to
          generic labels) should be used to name the output.

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

     There are 3 treatments for missing values: 
      - NA: kept as NA.
      - 0: missing values are considered as zero. Recommended for a PCA
     on compositionnal data.
      - "mean": missing values are given the mean frequency of the
     corresponding allele. Recommended for a centred PCA.

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

     Returns a list with the following components: 

     tab: matrix of allelic frequencies (rows: populations; columns:
          alleles).

    nobs: number of observations (i.e. alleles) for each population x
          locus combinaison.

    call: the matched call

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

     Thibaut Jombart t.jombart@imperial.ac.uk

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

     'genpop'

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

     data(microbov)
     obj1 <- microbov

     obj2 <- genind2genpop(obj1)

     Xfreq <- makefreq(obj2,missing="mean")

     if(require(ade4)){

     # perform a correspondance analysis on counts data

     Xcount <- genind2genpop(obj1,missing="chi2")
     ca1 <- dudi.coa(as.data.frame(Xcount@tab),scannf=FALSE)
     s.label(ca1$li,sub="Correspondance Analysis",csub=1.2)
     add.scatter.eig(ca1$eig,nf=2,xax=1,yax=2,posi="topleft")

     # perform a principal component analysis on frequency data
     pca1 <- dudi.pca(Xfreq$tab,scale=FALSE,scannf=FALSE)
     s.label(pca1$li,sub="Principal Component Analysis",csub=1.2)
     add.scatter.eig(pca1$eig,nf=2,xax=1,yax=2,posi="top")
     }

