AttributeList-class            package:sp            R Documentation

_C_l_a_s_s "_A_t_t_r_i_b_u_t_e_L_i_s_t"

_D_e_s_c_r_i_p_t_i_o_n:

     Attribute list; a kind of data.frame but without row.names

_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 'AttributeList(x)',
     with 'x' a list having elements of equal length.

_S_l_o_t_s:

     '_a_t_t': Object of class '"list"', containing the attributes
          variables. The variables are guaranteed to have equal length,
          and can be of any type that has a length 

_M_e_t_h_o_d_s:

     [ 'signature(x = "AttributeList")': subsets 

     _c_o_e_r_c_e 'signature(from = "AttributeList", to = "data.frame")':
          convert the list slot to data.frame 

     _c_o_e_r_c_e 'signature(from = "AttributeList", to = "list")': retrieve
          the list slot 

     _c_o_e_r_c_e 'signature(from = "data.frame", to = "AttributeList")': ... 

     _c_o_e_r_c_e 'signature(from = "list", to = "AttributeList")': ... 

     _a_s._l_i_s_t coerce AttributeList object to list

     _a_s._d_a_t_a._f_r_a_m_e coerce AttributeList object to data.frame

     _d_i_m retrieve dimensions of object, as if it were a data.frame:
          'dim(x)[1]' is the length of variables (nr or rows),
          'dim(x)[2]' the number of variables (nr of columns) 

     [[, $ retrieve a list element

     [[<-, $<- assign a list element

     _s_u_m_m_a_r_y calls 'summary.data.frame' on the list

     _n_a_m_e_s get names from the list

     _n_a_m_e_s<- assign names to the list

_N_o_t_e:

     In earlier versions (sp <= 0.7-6), objects of class
     SpatialPointsDataFrame-class, SpatialPixelsDataFrame-class and
     SpatialGridDataFrame-class had a slot of class data.frame to store
     the attribute information. It turns out that especially for larger
     grids, holding the grid attribute information in a data.frame
     requires up to a factor 11 more memory than needed by the data
     alone, for the sole reason that R creates unique row.names for
     each row (i.e., value).

     To get around this problem, we created the simple S4 AttributeList
     class which has a single slot which is a list, without row.names,
     but with a validator function that checks that all elements in the
     list have equal length. The class is meant to behave similar to a
     data.frame, having a similar set of methods. It does not
     automatically convert character data to factors.

     If you have row.names in your data.frame, and you want to keep
     them when you convert them to e.g. a SpatialPointsDataFrame-class
     object using coordinates, you should first copy the row.names to a
     column in the data.frame. If not, they will get lost.

_A_u_t_h_o_r(_s):

     Edzer J. Pebesma, e.pebesma@geo.uu.nl

_S_e_e _A_l_s_o:

     list, data.frame

_E_x_a_m_p_l_e_s:

     x = AttributeList(list(a = 1:10, b = sample(1:10), c = runif(10)))
     x
     summary(x)
     x = object.size(AttributeList(list(a = 1:1000000)))
     y = object.size(data.frame(a = 1:1000000))
     y / x

