data(example_data)
require(dplyr)
require(magrittr)
# one variable
encode_genotypes(example_data, SNP_a) %>%
select(SNP_a)
# multiple variables
encode_genotypes(example_data, SNP_a, SNP_b) %>%
select(SNP_a, SNP_b)
# using tidyselect helpers
encode_genotypes(example_data, dplyr::starts_with("SNP")) %>%
select(starts_with("SNP"))
Run the code above in your browser using DataLab