cap                package:cwhstring                R Documentation

_C_h_a_n_g_e _c_a_s_e _o_f _s_t_r_i_n_g_s

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

     'capply' apply function to elements in character vector (utility
     function) 'cap' and 'capitalize' change to capital letters.
     'lower' and 'lowerize' change to lower case letters. 'CapLeading'
     Capitalizes the first character of each element of a character
     vector

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

     capply(str,ff)
     cap(char)
     capitalize(str)
     lower(char)
     lowerize(str)
     CapLeading(str)

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

      ff: a function.

    char: a single letter.

     str: a character vector.

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

     The same as the argument.

_N_o_t_e:

     capply has been reverse engineered from the help page on strsplit:
     strReverse <- function(x) sapply(lapply(strsplit(x, NULL), rev),
     paste, collapse="")  can be written as  capply(x, rev)

_A_u_t_h_o_r(_s):

     Christian W. Hoffmann, christian.hoffmann@wsl.ch, <URL:
     http://www.wsl.ch/staff/christian.hoffmann>

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

     # capitalize shows the use of capply
     cap("f")    # "F"
     capitalize(c("TruE","faLSe"))  # "TRUE"  "FALSE"
     lower("R")  # "r"
     lowerize("TruE")  # "true"
     CapLeading(c("all you ","need"))     # "All you " "Need"
     capply(c("abc", "Statistics"), rev)  # "cba"    "tnahpele"

