Hello, I am filtering my data frame "tot" via:
controls=tot %>% filter_all(any_vars(. %in% c("E109", "E119","E149"))) %>% filter_all(any_vars(. %in% c("Caucasian"))) %>% filter_all(any_vars(. %in% c("No kinship found","Ten or more third-degree relatives identified"))) > dim(controls) [1] 15381 1093 > dim(tot) [1] 502536 1093 how do I add in my data frame "tot" a new column called "controls" where every of those filtered 15381 rows would have the value 1 and the rest which can be found in tot have the value -9? Thanks Ana [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.