Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

R rep()

rep(11, 4)
[1] 11 11 11 11
rep(NA, 5)
[1] NA NA NA NA NA
rep(1:4, 3)
[1] 1 2 3 4 1 2 3 4 1 2 3 4
rep(1:4, 3, length.out=9)
[1] 1 2 3 4 1 2 3 4 1
rep(1:4, each=2)
[1] 1 1 2 2 3 3 4 4
rep(1:4, 1:4)
[1] 1 2 2 3 3 3 4 4 4 4
data <- list(netflix = 1:4)
rep(data, 4)
$netflix
[1] 1 2 3 4
$netflix
[1] 1 2 3 4
$netflix
[1] 1 2 3 4
$netflix
[1] 1 2 3 4
result <- factor(LETTERS[1:4])
rep(result, 4)
[1] A B C D A B C D A B C D A B C D
Levels: A B C D
rep.int(1:4, 2)
[1] 1 2 3 4 1 2 3 4
rep_len(1:3, 10)
[1] 1 2 3 1 2 3 1 2 3 1
 
PREVIOUS NEXT
Tagged: #R
ADD COMMENT
Topic
Name
7+2 =