Description Usage Arguments Details Author(s) See Also Examples
expand2
generates duplicated observations within a dataframe.
1 |
data |
a data frame object |
n_n |
index or indexes specifying row numbers |
copies |
desired number of copies |
original |
a logical indicating whether to keep the original dataframe |
expand2
appends observations from the dataframe with n copies of the observations with specified indexes of observations or all data.
Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
#### Ref:
# HOW CAN I DETECT DUPLICATE OBSERVATIONS? | STATA FAQ
# from https://stats.idre.ucla.edu/stata/faq/how-can-i-detect-duplicate-observations-3/
# (accessed September 27, 2019).
required(haven)
# install.packages("haven")
hsb2 <- read_dta("https://stats.idre.ucla.edu/stat/stata/notes/hsb2.dta")
str(hsb2)
hsb2.new <- expand2(hsb2, 1:5, 4)
hsb2.new <- expand2(hsb2, 1:5, 4, original = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.