capitalize              package:R.utils              R Documentation

_C_a_p_i_t_a_l_i_z_e_s/_d_e_c_a_p_i_t_a_l_i_z_e_s _e_a_c_h _c_h_a_r_a_c_t_e_r _s_t_r_i_n_g _i_n _a _v_e_c_t_o_r

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

     Capitalizes/decapitalized (making the first letter upper/lower
     case) of each character string in a vector.

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

       ## Default S3 method:
       capitalize(str, ...)
       ## Default S3 method:
       decapitalize(str, ...)

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

     str: A 'vector' of 'character' strings to be capitalized.

     ...: Not used.

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

     Returns a 'vector' of 'character' strings of the same length as
     the input vector.

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

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

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

       words <- strsplit("Hello wOrld", " ")[[1]];
       cat(paste(toupper(words), collapse=" "), "\n")      # "HELLO WORLD"
       cat(paste(tolower(words), collapse=" "), "\n")      # "hello world"
       cat(paste(capitalize(words), collapse=" "), "\n")   # "Hello WOrld"
       cat(paste(decapitalize(words), collapse=" "), "\n") # "hello wOrld"

