polygons                 package:sp                 R Documentation

_s_e_t_s _s_p_a_t_i_a_l _c_o_o_r_d_i_n_a_t_e_s _t_o _c_r_e_a_t_e _s_p_a_t_i_a_l _d_a_t_a, _o_r _r_e_t_r_i_e_v_e_s
_s_p_a_t_i_a_l _c_o_o_r_d_i_n_a_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     sets spatial coordinates to create spatial data, or retrieves
     spatial coordinates

_U_s_a_g_e:

             polygons(obj)
             polygons(object) <- value

_A_r_g_u_m_e_n_t_s:

     obj: object of class "SpatialPolygonsDataFrame" 

  object: object of class "data.frame" 

   value: object of class "SpatialPolygons" 

_V_a_l_u_e:

     polygons returns the SpatialPolygons of obj; polygons<- promotes a
     data.frame to a SpatialPolygonsDataFrame object

_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) <- df$FIPS
     polygons(df) <- nc1
     class(df)

