The R Project SVN R

Rev

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

Rev 33548 Rev 34218
Line 2... Line 2...
2
\alias{sprintf}
2
\alias{sprintf}
3
\alias{gettextf}
3
\alias{gettextf}
4
\title{Use C-style String Formatting Commands}
4
\title{Use C-style String Formatting Commands}
5
\description{
5
\description{
6
  A wrapper for the C function \code{sprintf}, that returns a character
6
  A wrapper for the C function \code{sprintf}, that returns a character
7
  vector of length one containing a formatted combination of text and
7
  vector containing a formatted combination of text and variable values.
8
  variable values.
-
 
9
}
8
}
10
\usage{
9
\usage{
11
sprintf(fmt, \dots)
10
sprintf(fmt, \dots)
12
gettextf(fmt, \dots, domain = NULL)
11
gettextf(fmt, \dots, domain = NULL)
13
}
12
}
Line 39... Line 38...
39
  one of the letters in the set \code{difeEgGsxX\%}.  These letters
38
  one of the letters in the set \code{difeEgGsxX\%}.  These letters
40
  denote the following types:
39
  denote the following types:
41
 
40
 
42
  \describe{
41
  \describe{
43
    \item{\code{d, i, x, X}}{Integer value, \code{x} and \code{X}
42
    \item{\code{d, i, x, X}}{Integer value, \code{x} and \code{X}
44
      being hexadecimal. Numeric variables with exactly integer values
43
      being hexadecimal (using the same case for \code{a-f} as the code).
45
      will be coerced to integer.
44
      Numeric variables with exactly integer values will be coerced to integer.
46
    }
45
    }
47
 
-
 
48
    \item{\code{f}}{Double precision value, in decimal notation of the
46
    \item{\code{f}}{Double precision value, in decimal notation of the
49
      form "[-]mmm.ddd".  The number of decimal places is specified by
47
      form "[-]mmm.ddd".  The number of decimal places is specified by
50
      the precision: the default is 6; a precision of 0 suppresses the
48
      the precision: the default is 6; a precision of 0 suppresses the
51
      decimal point.
49
      decimal point.
52
    }
50
    }
53
    
-
 
54
    \item{\code{e, E}}{Double precision value, in decimal notation of the
51
    \item{\code{e, E}}{Double precision value, in decimal notation of the
55
      form \code{[-]m.ddde[+-]xx} or \code{[-]m.dddE[+-]xx}.
52
      form \code{[-]m.ddde[+-]xx} or \code{[-]m.dddE[+-]xx}.
56
    }
53
    }
57
 
-
 
58
    \item{\code{g, G}}{Double precision value, in \code{\%e} or
54
    \item{\code{g, G}}{Double precision value, in \code{\%e} or
59
      \code{\%E} format if the exponent is less than -4 or greater than or
55
      \code{\%E} format if the exponent is less than -4 or greater than or
60
      equal to the precision, and \code{\%f} format otherwise.
56
      equal to the precision, and \code{\%f} format otherwise.
61
    }
57
    }
62
 
-
 
63
    \item{\code{s}}{Character string.}
58
    \item{\code{s}}{Character string.}
64
 
-
 
65
    \item{\code{\%}}{Literal \code{\%} (none of the formatting
59
    \item{\code{\%}}{Literal \code{\%} (none of the formatting
66
      characters given below are permitted in this case).}
60
      characters given below are permitted in this case).}
67
  }
61
  }
68
  \code{\link{as.character}} is used for non-character argument with
62
  \code{\link{as.character}} is used for non-character arguments with
69
  \code{s} and \code{\link{as.double}} for non-double arguments with
63
  \code{s} and \code{\link{as.double}} for non-double arguments with
70
  \code{f, e, E, g, G}.  NB: the length is determined before conversion,
64
  \code{f, e, E, g, G}.  NB: the length is determined before conversion,
71
  so do not rely on the internal coercion if this would change the
65
  so do not rely on the internal coercion if this would change the
72
  length.
66
  length.
73
  
67