data_rep {quickcode} | R Documentation |
Duplicate a data rows or columns X times
Description
Add a data to itself X times by rows or columns
Usage
data_rep(., n, which = c("rows", "cols"))
Arguments
. |
data frame variable |
n |
multiples of duplicate |
which |
where to append the duplicated data e.g. rows or cols |
Value
the duplicated dataset store to a variable with the name of the first
Examples
# initialize p1 and p2
init(p1,p2)
p1
p2
# declare p1 and p2 as data frame
p1 <- data.frame(PK=1:10,ID2=1:10)
p2 <- data.frame(PK=11:20,ID2=21:30)
p1
p2
#add p1 twice by row, and resave as p1
data_rep(p1,n=2,"rows")
p1 #p1 has been updated
#add p2 3 times by col, and resave as p2
data_rep(p2,n=3,"cols")
p2 #p2 has been updated
[Package quickcode version 0.9.1 Index]