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

