Hi,
May be this helps:
Kgeno<- read.table(text="
SNP_ID SNP1 SNP2 SNP3 SNP4
Maj_Allele C G C A
Min_Allele T A T G
ID1 CC GG CT AA
ID2 CC GG CC AA
ID3 CC GG nc AA
ID4 _ _ _ _
ID5 CC GG CC AA
ID6 CC GG CC AA
ID7 CC GG CT AA
ID8 _ _ _ _
ID9 CT
Hello,
If you have read in the data as factors (stringsAsFactors = TRUE, the
default), change the function to the following.
fun <- function(x){
x[x %in% c("nc", "_")] <- NA
MM <- paste0(as.character(x[1]), as.character(x[1])) # Major Major
Mm <- paste0(as.character(x
Hello,
I'm not sure I understood, but try the following.
Kgeno <- read.table(text = "
SNP_ID SNP1 SNP2 SNP3 SNP4
Maj_Allele C G C A
Min_Allele T A T G
ID1 CC GG CT AA
ID2 CC GG CC AA
ID3 CC GGncAA
ID4 _ _ _ _
ID5 CC GG CC AA
ID6 CC GG CC
3 matches
Mail list logo