The R Project SVN R

Rev

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

Rev 32235 Rev 35279
Line 1... Line 1...
1
\name{toString}
1
\name{toString}
2
\alias{toString}
2
\alias{toString}
3
\alias{toString.default}
3
\alias{toString.default}
4
 
4
 
5
\title{toString Converts its Argument to a Character String}
5
\title{Convert an R Object to a Character String}
6
\description{
6
\description{
7
  This is a helper function for \code{\link{format}}. It converts its argument
7
  This is a helper function for \code{\link{format}} to produce a single
8
  to a string. If the argument is a vector then its elements are
-
 
9
  concatenated with a \code{,} as a separator. 
8
  character string describing an \R object.
10
  Most methods should honor the width argument. 
-
 
11
}
9
}
12
\usage{
10
\usage{
13
toString(x, \dots)
11
toString(x, \dots)
14
 
12
 
15
\method{toString}{default}(x, width, \dots)
13
\method{toString}{default}(x, width = NULL, \dots)
16
}
14
}
17
\arguments{
15
\arguments{
18
  \item{x}{The object to be converted.}
16
  \item{x}{The object to be converted.}
19
  \item{width}{The returned value has at most \code{width} characters.
17
  \item{width}{Suggestion for the maximum field width.  Values of
-
 
18
    \code{NULL} or \code{0} indicate no maximum.
20
    The minimum value accepted is 6 and smaller values are taken as 6.}
19
    The minimum value accepted is 6 and smaller values are taken as 6.}
21
  \item{\dots}{Optional arguments for methods.}
20
  \item{\dots}{Optional arguments passed to or from methods.}
22
}
21
}
23
\details{
22
\details{
-
 
23
  This is a generic function for which methods can be written: only the
-
 
24
  default method is described here.  Most methods should honor the
-
 
25
  \code{width} argument to specify the maximum display width (as measured
-
 
26
  by \code{\link{nchar}(type = "width"}) of the result.
-
 
27
 
24
  The default method returns the first \code{width - 4} characters of
28
  The default method first converts \code{x} to character and then
-
 
29
  concatenates the elements separated by \code{", "}.
-
 
30
  If \code{width} is supplied and is not \code{NULL}, the default method
-
 
31
  returns the first \code{width - 4} characters of the result with
25
  the result with \code{....} appended, if the full result would use
32
  \code{....} appended, if the full result would use more than
26
  more than \code{width} characters.
33
  \code{width} characters.
27
}
34
}
28
\value{
35
\value{
29
  A character vector of length 1 is returned.
36
  A character vector of length 1 is returned.
30
}
37
}
31
\author{ Robert Gentleman }
38
\author{ Robert Gentleman }