stata_expand | R Documentation |
Takes a dataframe and duplicates it n times, then creates a variable (default name is Duplicate) which has a value of 0 if the observation originally appeared int he dataset and i = 1,..,n for each duplicate.
stata_expand(df, n, name = "Duplicate")
df |
Data frame |
n |
Number of times to duplicate (i.e. to end up with 2 copies of everything then n = 1) |
name |
Character string indicating the name of the variable indicating which rows are duplicates |
A data frame
df <- data.frame(x = 1:5, y = c("a","b","c","d", "e"))
stata_expand(df, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.