The R Project SVN R

Rev

Rev 88638 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 88638 Rev 89383
Line 1... Line 1...
1
% File src/library/base/man/rep.Rd
1
% File src/library/base/man/rep.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2015, 2017 R Core Team
3
% Copyright 1995-2015, 2017, 2019, 2026 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{rep}
6
\name{rep}
7
\alias{rep}
7
\alias{rep}
8
\alias{rep.factor}
8
\alias{rep.factor}
Line 10... Line 10...
10
\alias{rep.POSIXct}
10
\alias{rep.POSIXct}
11
\alias{rep.POSIXlt}
11
\alias{rep.POSIXlt}
12
\alias{rep.Date}
12
\alias{rep.Date}
13
\alias{rep_len}
13
\alias{rep_len}
14
 
14
 
15
\title{Replicate Elements of Vectors and Lists}
15
\title{Replicate Elements of Vectors and Vector-Like Objects}
16
\description{
16
\description{
17
  \code{rep} replicates the values in \code{x}.  It is a generic
17
  \code{rep} replicates the values in \code{x}.  It is a generic
18
  function, and the (internal) default method is described here.
18
  function, and the (internal) default method is described here.
19
 
19
 
20
  \code{rep.int} and \code{rep_len} are faster simplified versions for
20
  \code{rep.int} and \code{rep_len} are faster simplified versions for
21
  two common cases.  Internally, they are generic, so methods can be
21
  two common cases.  Internally, they are generic, so methods can be
22
  defined for them (see \link{InternalMethods}).
22
  defined for them (see \link{InternalMethods}).
-
 
23
  Except if \code{x} is a factor,
-
 
24
  when internal dispatch for \code{rep.int} and \code{rep_len} fails,
-
 
25
  there is an attempt to dispatch on the equivalent call to \code{rep}.
23
}
26
}
24
\usage{
27
\usage{
25
rep(x, \dots)
28
rep(x, \dots)
26
 
29
 
27
rep.int(x, times)
30
rep.int(x, times)
Line 84... Line 87...
84
}
87
}
85
\value{
88
\value{
86
  An object of the same type as \code{x}.
89
  An object of the same type as \code{x}.
87
 
90
 
88
  \code{rep.int} and \code{rep_len} return no attributes (except the
91
  \code{rep.int} and \code{rep_len} return no attributes (except the
89
  class if returning a factor).
92
  class and levels if returning a factor).
90
 
93
 
91
  The default method of \code{rep} gives the result names (which will
94
  The default method of \code{rep} gives the result names (which will
92
  almost always contain duplicates) if \code{x} had names, but retains
95
  almost always contain duplicates) if \code{x} had names, but retains
93
  no other attributes.
96
  no other attributes.
94
}
97
}