The R Project SVN R

Rev

Rev 32245 | Rev 35297 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32245 Rev 35281
Line 7... Line 7...
7
  \code{encodeString} escapes the strings in a character vector in the
7
  \code{encodeString} escapes the strings in a character vector in the
8
  same way \code{print.default} does, and optionally fits the encoded
8
  same way \code{print.default} does, and optionally fits the encoded
9
  strings within a field width.
9
  strings within a field width.
10
}
10
}
11
\usage{
11
\usage{
12
encodeString(x, w = 0, quote = "", na = TRUE,
12
encodeString(x, width = 0, quote = "", na.encode = TRUE,
13
             justify = c("left", "right", "centre"))
13
             justify = c("left", "right", "centre", "none"))
14
}
14
}
15
\arguments{
15
\arguments{
16
  \item{x}{A character vector, or an object that can be coerced to one
16
  \item{x}{A character vector, or an object that can be coerced to one
17
    by \code{\link{as.character}}.}
17
    by \code{\link{as.character}}.}
18
  \item{w}{integer: the minimum field width.  If \code{NA}, this is
18
  \item{width}{integer: the minimum field width.  If \code{NULL} or
19
    taken to be the largest field width needed for any element of \code{x}.}
19
    \code{NA}, this is taken to be the largest field width needed for
-
 
20
    any element of \code{x}.}
20
  \item{quote}{character: quoting character, if any.}
21
  \item{quote}{character: quoting character, if any.}
21
  \item{na}{logical: should \code{NA} strings be encoded?}
22
  \item{na.encode}{logical: should \code{NA} strings be encoded?}
22
  \item{justify}{character: partial matches are allowed.  If padding to
23
  \item{justify}{character: partial matches are allowed.  If padding to
23
    the minimum field width is needed, how should spaces be inserted?}
24
    the minimum field width is needed, how should spaces be inserted?
-
 
25
    \code{justify == "none"} is equivalent to \code{width = 0}, for
-
 
26
    consistency with \code{format.default}.}
24
}
27
}
25
\details{
28
\details{
26
  This escapes backslash and the control characters \code{\a} (bell),
29
  This escapes backslash and the control characters \code{\a} (bell),
27
  \code{\b} (backspace), \code{\f} (formfeed), \code{\n} (line feed),
30
  \code{\b} (backspace), \code{\f} (formfeed), \code{\n} (line feed),
28
  \code{\r} (carriage return), \code{\t} (tab), \code{\v} (vertical tab)
31
  \code{\r} (carriage return), \code{\t} (tab), \code{\v} (vertical tab)
29
  and \code{\0} (nul) as well as any non-printable characters, which are
32
  and \code{\0} (nul) as well as any non-printable characters in a
-
 
33
  single-byte locale, which are printed in octal notation
30
  printed in octal notation (\code{\xyz} with leading zeroes).
34
  (\code{\xyz} with leading zeroes).
31
#ifdef unix
35
#ifdef unix
32
  (Which characters are non-printable depends on the current locale.)
36
  (Which characters are non-printable depends on the current locale.)
33
#endif
37
#endif
34
#ifdef windows
38
#ifdef windows
35
  (Windows' reporting of printable characters is unreliable, so all
39
  (Windows' reporting of printable characters is unreliable, so all
36
  other control characters are regarded as non-printable, and all
40
  other control characters are regarded as non-printable, and all
37
  characters with codes 32--255 as printable.)
41
  characters with codes 32--255 as printable.)
38
#endif
42
#endif
-
 
43
  See \code{\link{print.default}} for how non-printable characters are
-
 
44
  handled in multi-byte locales.
39
 
45
 
40
  If \code{quote} is a single or double quote any embedded quote of the
46
  If \code{quote} is a single or double quote any embedded quote of the
41
  same type is escaped.  Note that justification is of the quoted
47
  same type is escaped.  Note that justification is of the quoted
42
  string, hence spaces are added outside the quotes.
48
  string, hence spaces are added outside the quotes.
43
}
49
}
-
 
50
\note{
-
 
51
  The default for \code{width} is different from \code{format.default},
-
 
52
  which as of \R 2.2.0 does similar things for character vectors.
-
 
53
}
44
\value{
54
\value{
45
  A character vector of the same length as \code{x}, with the same
55
  A character vector of the same length as \code{x}, with the same
46
  attributes (including names and dimensions).
56
  attributes (including names and dimensions).
47
}
57
}
48
\seealso{
58
\seealso{