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))

