quadrant               package:sfsmisc               R Documentation

_G_i_v_e _t_h_e _Q_u_a_d_r_a_n_t _N_u_m_b_e_r _o_f _P_l_a_n_a_r _P_o_i_n_t_s

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

     Determine the quadrant of planar points, i.e. in which of the four
     parts cut by the x- and y- axis the points lie.  Zero values (i.e.
     points on the axes) are treated as if _positive_.

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

     quadrant(x, y=NULL)

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

     x,y: numeric vectors of the same length, or 'x' is an `x-y'
          structure and 'y=NULL', see 'xy.coords'.

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

     numeric vector of same length as 'x' (if that's a vector) with
     values in '1:4' indicating the quadrant number of the
     corresponding point.

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

     xy <- as.matrix(expand.grid(x= -7:7, y= -7:7)); rownames(xy) <- NULL
     (qu <- quadrant(xy))
     plot(xy, col = qu+1, main = "quadrant() number", axes = FALSE)
     abline(h=0, v=0, col="gray") # the x- and y- axis
     text(xy, lab = qu, col = qu+1, adj = c(1.4,0))

