On Friday, May 22, 2020, 6:16:45 PM EDT, Herv? Pag?s <hpages at fredhutch.org> wrote:
Gabe,
It's the current behavior of paste() that is a major source of bugs:
?? ## Add "rs" prefix to SNP ids and collapse them in a
?? ## comma-separated string.
?? collapse_snp_ids <- function(snp_ids)
?????? paste("rs", snp_ids, sep="", collapse=",")
?? snp_groups <- list(
???? group1=c(55, 22, 200),
???? group2=integer(0),
???? group3=c(99, 550)
?? )
?? vapply(snp_groups, collapse_snp_ids, character(1))
?? #??????????? group1??????????? group2??????????? group3
?? # "rs55,rs22,rs200"????????????? "rs"????? "rs99,rs550"
This has hit me so many times!
Now with 'collapse0=TRUE', we finally have the opportunity to make it do
the right thing. Let's not miss that opportunity.
Cheers,
H.