Description Usage Arguments Value Author(s) Examples
When the input vector is longer than the expected length, the vector will be truncated. When the input vector is shorter than the expected length, part or the whole body of it will be replcated to match the length. The overhead part will then also be truncated.
1 2 |
x |
input vector |
length.out |
numeric, the length of the expected result vector. It is
consistent with |
rep.which |
NULL or an integer vector, indicating the element index in
|
rep.extend |
character, the method to extend
|
append |
a vector for replication to append to
|
a vector of length length.out
Yiying Wang, wangy@aetna.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
x <- letters[1:5]
aline(x, length.out=9, rep.which=2:3)
# [1] "a" "b" "c" "b" "c" "b" "c" "d" "e"
aline(x, length.out=9, rep.which=2:3, rep.extend='each')
# [1] "a" "b" "b" "b" "c" "c" "c" "d" "e"
aline(x, 9, rep.which=2:3, rep.extend='times', append=NA)
# [1] "a" "b" "c" "d" "e" NA NA NA NA
aline(x, 9, rep.extend='each', append=c('m', 'n'))
# [1] "a" "b" "c" "d" "e" "m" "m" "n" "n"
y <- structure(1:5, names=letters[1:5])
aline(y, length.out=9, rep.which=2:3)
# a b c b c b c d e
# 1 2 3 2 3 2 3 4 5
aline(y, length.out=9, rep.which=c(2, 4))
# a b b b c d d d e
# 1 2 2 2 3 4 4 4 5
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.