kasc2df              package:adehabitat              R Documentation

_C_o_n_v_e_r_s_i_o_n _o_f _O_b_j_e_c_t_s _o_f _C_l_a_s_s _k_a_s_c

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

     An object of class 'kasc' stores several maps in a data frame (one
     column per variable, and one row per pixel of the raster map).
     However, the features mapped are rarely rectangle-shaped, whereas
     the map are inevitably rectangles.  Therefore, a lot of pixels of
     the maps do not contain data.  The pixels of the map that do not
     contain data are 'NA' in this data frame.  'kasc2df' will "clean"
     the object of class 'kasc' from these NAs, and will return a data
     frame containing only mapped values that can be used in subsequent
     analysis. 
      After these analyses, 'df2kasc' may be used to convert the
     modified data frame to an object of  class 'kasc' for mapping
     (e.g. for maps of factorial axes, using 'dudi' analyses, see
     'help(dudi)').

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

     kasc2df(x, var = names(x))
     df2kasc(df, index, x)

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

       x: an object of class 'kasc' in 'kasc2df'
           an object of class 'kasc' or 'mapattr' in 'df2kasc'

     var: a character vector.  The names of the variables in the 'kasc'
          that are to be kept in the output

      df: a data frame resulting of a computation of the component
          'tab' of the list previously returned by the  'kasc2df' (see
          section 'Value' below).  This computation may be any form of
          analysis (Principal component analysis, modelling techniques,
          etc.) 

   index: an integer vector giving the position of the rows of 'df' in
          the returned 'kasc' (such an index can be computed using
          'kasc2df')

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

     'kasc2df' returns a list with the following components: 

     tab: a data frame without NAs, with a number of variables equals
          to 'length(var)'.

   index: a vector of indices of the rows of the 'kasc' kept for the
          analyses (that is, not 'NA').

     'df2kasc' returns an object of class 'kasc'.

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

     Clment Calenge calenge@biomserv.univ-lyon1.fr

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

     'as.kasc' for additional information on objects of class 'kasc'.

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

     data(puechabon)
     kasc <- puechabon$kasc

     # Display the kasc object
     image(kasc)

     # Preparation for Principal component analysis
     x <- kasc2df(kasc)
     x$tab <- x$tab[, (names(x$tab) != "Aspect")]

     # Principal component analysis
     ana <- dudi.pca(x$tab, scannf = FALSE)

     s.arrow(ana$co)
     s.label(ana$li, clab = 0)

     ## Map of the scores of the rows
     scores <- df2kasc(ana$li, x$index, kasc)
     image(scores)

