sQuote                 package:base                 R Documentation

_Q_u_o_t_e _T_e_x_t

_D_e_s_c_r_i_p_t_i_o_n:

     Single or double quote text by combining with appropriate single
     or double left and right quotation marks.

_U_s_a_g_e:

     sQuote(x)
     dQuote(x)

_A_r_g_u_m_e_n_t_s:

       x: an R object, to be coerced to a character vector.

_D_e_t_a_i_l_s:

     The purpose of the functions is to provide a simple means of
     markup for quoting text to be used in the R output, e.g., in
     warnings or error messages.

     The choice of the appropriate quotation marks depends on both the
     locale and the available character sets.  Older Unix/X11 fonts
     displayed the grave accent (ASCII code 0x60) and the apostrophe
     (0x27) in a way that they could also be used as matching open and
     close single quotation marks.  Using modern fonts, or non-Unix
     systems, these characters no longer produce matching glyphs. 
     Unicode provides left and right single quotation mark characters
     (U+2018 and U+2019); if Unicode markup cannot be assumed to be
     available, it seems good practice to use the apostrophe as a
     non-directional single quotation mark.

     Similarly, Unicode has left and right double quotation mark
     characters (U+201C and U+201D); if only ASCII's typewriter
     characteristics can be employed, than the ASCII quotation mark
     (0x22) should be used as both the left and right double quotation
     mark.

     Some other locales also have the directional quotation marks,
     notably on Windows.  TeX uses grave and apostrophe for the
     directional single quotation marks, and doubled grave and doubled
     apostrophe for the directional double quotation marks.

     What rendering is used depend on the 'options' setting for
     'useFancyQuotes'.  If this is 'FALSE' then the undirectional ASCII
     quotation style is used.  If this is 'TRUE' (the default), Unicode
     directional quotes are used are used where available (currently,
     UTF-8 locales on Unix-alikes and all Windows locales except 'C'):
     if set to '"UTF-8"' UTF-8 markup is used (whatever the current
     locale). If set to '"TeX"', TeX-style markup is used.  Finally, if
     this is set to a character vector of length four, the first two
     entries are used for beginning and ending single quotes and the
     second two for beginning and ending double quotes: this can be
     used to implement non-English quoting conventions such as the use
     of guillemets.

     Where fancy quotes are used, you should be aware that they may not
     be rendered correctly as not all fonts include the requisite
     glyphs: for example some have directional single quotes but not
     directional double quotes.

_V_a_l_u_e:

     A character vector in the current locale's encoding.

_R_e_f_e_r_e_n_c_e_s:

     Markus Kuhn, "ASCII and Unicode quotation marks". <URL:
     http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html>

_S_e_e _A_l_s_o:

     'Quotes' for quoting R code.

     'shQuote' for quoting OS commands.

_E_x_a_m_p_l_e_s:

     op <- options("useFancyQuotes")
     paste("argument", sQuote("x"), "must be non-zero")
     options(useFancyQuotes = FALSE)
     cat("\ndistinguish plain", sQuote("single"), "and",
         dQuote("double"), "quotes\n")
     options(useFancyQuotes = TRUE)
     cat("\ndistinguish fancy", sQuote("single"), "and",
         dQuote("double"), "quotes\n")
     options(useFancyQuotes = "TeX")
     cat("\ndistinguish TeX", sQuote("single"), "and",
         dQuote("double"), "quotes\n")
     if(l10n_info()$`Latin-1`) {
         options(useFancyQuotes = c("\xab", "\xbb", "\xbf", "?"))
         cat("\n", sQuote("guillemet"), "and",
             dQuote("Spanish question"), "styles\n")
     } else if(l10n_info()$`UTF-8`) {
         options(useFancyQuotes = c("\xc2\xab", "\xc2\xbb", "\xc2\xbf", "?"))
         cat("\n", sQuote("guillemet"), "and",
             dQuote("Spanish question"), "styles\n")
     }
     options(op)

