Description Usage Arguments Value Author(s) Examples
dupes_tag
is similar to the duplicates tag function in STATA. It takes in a data frame and returns that data frame with a an additional column labeled 'dupes'. Dupes is the count of all other observations that have the same covariate pattern in the columns listed in ...
1 |
df |
a data frame |
... |
any number of columns of df. Must be listed in quotes |
a numeric vector
Sven Halvorson (svenedmail@gmail.com)
1 2 3 4 5 6 7 8 9 10 | library("dplyr")
#create a little test set
test.set = data.frame(v1 = sample(x = c("A","B","C"),size = 20, replace = TRUE),
v2 = sample(x = 1:2, size = 20, replace = TRUE),
v3 = sample(x = c("foo", "bar"), size = 20, replace = TRUE))
test.set = arrange(test.set,v1,v2,v3)
test.set$dupes = dupes_tag(test.set,"v1","v2","v3")
test.set
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.