char2dms                 package:sp                 R Documentation

_C_o_n_v_e_r_t _c_h_a_r_a_c_t_e_r _v_e_c_t_o_r _t_o _D_M_S-_c_l_a_s_s _o_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     These two helper functions convert character vectors and decimal
     degree vectors to the DMS-class representation of degrees,
     minutes, and decimal seconds. "DMS" objects cannot contain NAs.

_U_s_a_g_e:

     char2dms(from, chd = "d", chm = "'", chs = "\"")
     dd2dms(dd, NS = FALSE)

_A_r_g_u_m_e_n_t_s:

    from: character vector of degree, minute, decimal second data

     chd: degree character terminator

     chm: minute character terminator

     chs: second character terminator

      dd: numeric vector of decimal degrees

      NS: logical, TRUE for north/south decimal degrees, FALSE for
          east/west decimal degrees

_D_e_t_a_i_l_s:

     In char2dms, the input data vector should use a regular format,
     such as that used in the PROJ.4 library, with a trailing capital
     (NSWE) indicating compass direction.

_V_a_l_u_e:

     Both functions return a "DMS" object.

_M_e_t_h_o_d_s:


     _f_r_o_m = "_D_M_S", _t_o = "_n_u_m_e_r_i_c" coerce a '"DMS"' object to a
          '"numeric"' vector

     _f_r_o_m = "_D_M_S", _t_o = "_c_h_a_r_a_c_t_e_r" coerce a '"DMS"' object to a
          '"character"' vector (the 'as.character.DMS' S3 function is
          also available)

_A_u_t_h_o_r(_s):

     Roger Bivand Roger.Bivand@nhh.no

_S_e_e _A_l_s_o:

     'DMS-class'

_E_x_a_m_p_l_e_s:

     data(state)
     str(state.center$y)
     stateN <- dd2dms(state.center$y, NS=TRUE)
     str(attributes(stateN))
     ch.stateN <- as.character(stateN)
     str(ch.stateN)
     stateNa <- char2dms(ch.stateN)
     str(attributes(stateNa))
     ch.stateN <- as(stateN, "character")
     str(ch.stateN)
     stateNa <- char2dms(ch.stateN)
     str(attributes(stateNa))

