[R] filter and add a column
Ana Marija
@okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Tue Aug 6 20:19:33 CEST 2019
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]]
More information about the R-help
mailing list