library(dplyr)
my_df <- data_frame(a = c(1:3,1), b = c(1:3,1), c = letters[1:4])
df_names <- names(my_df)
# doesn't throw an error, but doesn't produce the right results
my_df %>% distinct(!! df_names[df_names != "c"])
# A tibble: 4 x 3
a b c
<dbl> <dbl> <chr>
1 1 1 a
2 2 2 b
3 3 3 c
4 1 1 d
--
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+unsubscribe@googlegroups.com.
To post to this group, send email to manip...@googlegroups.com.
Visit this group at https://groups.google.com/group/manipulatr.
For more options, visit https://groups.google.com/d/optout.
library(dplyr)
my_df <- data_frame(a = c(1:3,1), b = c(1:3,1), c = letters[1:4])
df_names <- names(my_df)
# What I'd like:
#my_df %>% distinct(!! df_names[df_names != "c"])
# What works:
cols_to_check <- which(df_names != "c")
temp_df <- my_df[,cols_to_check]
rows_to_keep <- !duplicated(temp_df)
my_df <- my_df[rows_to_keep,]
> email to manipulatr+unsubscribe@googlegroups.com.
> To post to this group, send email to manip...@googlegroups.com.
> Visit this group at https://groups.google.com/group/manipulatr.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+unsubscribe@googlegroups.com.
> email to manipulatr+...@googlegroups.com.
> To post to this group, send email to manip...@googlegroups.com.
> Visit this group at https://groups.google.com/group/manipulatr.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+unsubscribe@googlegroups.com.