SpatialPolygonsDataFrame-class      package:sp      R Documentation

_C_l_a_s_s "_S_p_a_t_i_a_l_P_o_l_y_g_o_n_s_D_a_t_a_F_r_a_m_e"

_D_e_s_c_r_i_p_t_i_o_n:

     class to hold polygons with attributes

_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 to the function
     SpatialPolygonsDataFrame

_S_l_o_t_s:

     '_d_a_t_a': Object of class '"data.frame"'; attribute table 

     '_p_o_l_y_g_o_n_s': Object of class '"list"'; see SpatialPolygons-class 

     '_p_l_o_t_O_r_d_e_r': Object of class '"integer"'; see
          SpatialPolygons-class 

     '_b_b_o_x': Object of class '"matrix"'; see Spatial-class

     '_p_r_o_j_4_s_t_r_i_n_g': Object of class '"CRS"'; see CRS-class

_E_x_t_e_n_d_s:

     Class '"SpatialPolygons"', directly. Class '"Spatial"', by class
     '"SpatialPolygons"'.

_M_e_t_h_o_d_s:

     No methods defined with class "SpatialPolygonsDataFrame" in the
     signature.

_N_o_t_e:

     'SpatialPolygonsDataFrame' with default ID matching checks the
     data frame row names against the Polygons ID slots. They must then
     agree with each other, and be unique (no Polygons objects can
     share IDs); the data frame rows will be re-ordered if needed to
     match the Polygons IDs.

_A_u_t_h_o_r(_s):

_R_e_f_e_r_e_n_c_e_s:

_S_e_e _A_l_s_o:

     SpatialPolygons-class

_E_x_a_m_p_l_e_s:

     data(ncshp)
     nc1 <- as.SpatialPolygons.Shapes(nc.shp$Shapes, as.character(nc.shp$att.data$FIPS))
     df <- nc.shp$att.data
     rownames(df) <- as.character(nc.shp$att.data$FIPS)
     identical(rownames(df), getSpPPolygonsIDSlots(nc1))
     ncSpPDF <- SpatialPolygonsDataFrame(nc1, df)
     names(as(ncSpPDF, "data.frame"))
     identical(rownames(as(ncSpPDF, "data.frame")), getSpPPolygonsIDSlots(ncSpPDF))
     rrt <- as(ncSpPDF, "data.frame")$SID74/as(ncSpPDF, "data.frame")$BIR74
     brks <- quantile(rrt, seq(0,1,1/7))
     cols <- grey((length(brks):2)/length(brks))
     dens <- (2:length(brks))*3
     plot.SpatialPolygons(ncSpPDF, col=cols[findInterval(rrt, brks, all.inside=TRUE)])
     plot.SpatialPolygons(ncSpPDF, density=dens[findInterval(rrt, brks, all.inside=TRUE)])

