noquote                 package:base                 R Documentation

_C_l_a_s_s _f_o_r "_n_o _q_u_o_t_e" _P_r_i_n_t_i_n_g _o_f _C_h_a_r_a_c_t_e_r _S_t_r_i_n_g_s

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

     Print character strings without quotes.

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

     noquote(obj)

     ## S3 method for class 'noquote':
     print(x, ...)

     ## S3 method for class 'noquote':
     c(..., recursive = FALSE)

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

     obj: any R object, typically a vector of 'character' strings.

       x: an object of class '"noquote"'.

     ...: further options passed to next methods, such as 'print'.

recursive: for compatibility with the generic 'c' function.

_D_e_t_a_i_l_s:

     'noquote' returns its argument as an object of class '"noquote"'. 
     There is a method for 'c()' and subscript method ('"[.noquote"')
     which ensures that the class is not lost by subsetting.  The print
     method ('print.noquote') prints character strings _without_ quotes
     ('"..."').

     These functions exist both as utilities and as an example of using
     (S3) 'class' and object orientation.

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

     Martin Maechler maechler@stat.math.ethz.ch

_S_e_e _A_l_s_o:

     'methods', 'class', 'print'.

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

     letters
     nql <- noquote(letters)
     nql
     nql[1:4] <- "oh"
     nql[1:12]

     cmp.logical <- function(log.v)
     {
       ## Purpose: compact printing of logicals
       log.v <- as.logical(log.v)
       noquote(if(length(log.v)==0)"()" else c(".","|")[1+log.v])
     }
     cmp.logical(runif(20) > 0.8)

