Description Usage Arguments Value Examples
This function compares two data frames (including NA values) and returns the differing rows and columns which both data frames have in common
1 | df_compare(df_1, df_2, by_vars)
|
df_1 |
first data frame to compare |
df_2 |
second data frame to compare |
by_vars |
a single or combination of variables for which the input data frames are unique |
a list whose individual members are data frames, one for each column containing a difference
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | df_1 <-
data.frame(
pt_id = sort(rep(1:10, 3)),
vst_num= rep(1:3, 10),
vals_1 = rbinom(30,10,0.5),
vals_2 = runif(30),
vals_3 = rnorm(30)
)
df_2 <- df_1[ -8, ]
df_2[ c(3, 12), c('vals_1', 'vals_2', 'vals_3')] <- sample(c(NA, 99), 6, replace = T)
df_compare(
df_1 = df_1,
df_2 = df_2,
by_vars = c('pt_id', 'vst_num')
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.