I am attempting to add various column together with rowSums
but I am having some issues. Here is a list of column names:
colnames(No_Low_No_Intergenic_snpeff)
"CHROM" "POS" "REF" "ALT" "QUAL" "ANN.ALLELE" "ANN.EFFECT"
"ANN.IMPACT" "ANN.GENE" "ANN.GENEID" "ANN.FEATURE" "ANN.FEATUREID"
"ANN.HGVS_C" "ANN.HGVS_P" "ANN.ERRORS" "GEN.C02141.GT" "GEN.C00611.GT"
"GEN.C00633.GT" "GEN.C00634.GT" "GEN.C00644.GT" "GEN.C00647.GT" "GEN.C00648.GT"
"GEN.C00649.GT" "GEN.C00650.GT" "GEN.C00653.GT" "GEN.C00655.GT" "GEN.C00656.GT"
"GEN.C00657.GT" "GEN.C00659.GT" "GEN.C00682.GT" "GEN.C00705.GT" "GEN.C00707.GT"
"GEN.C00720.GT" "GEN.C00783.GT" "GEN.C01431.GT" "GEN.C01944.GT" "GEN.C01943.GT"
"GEN.C01403.GT" "GEN.C01158.GT" "GEN.C01157.GT" "GEN.C01156.GT" "GEN.C01033.GT"
"GEN.C00736.GT" "GEN.C00639.GT" "GEN.C99686.GT"
All of the columns that I am working with are labled GEN.Cxxxxx.GT
and all the values in those column range from 0-2. I am trying to sum columns 20:29 and column 45 and then put the values in a new column called controls
:
No_Low_No_Intergenic_snpeff.scores$controls <- rowSums(No_Low_No_Intergenic_snpeff.scores[,20:29,45])
but when I try running that command I get the following error:
Error in rowSums(No_Low_No_Intergenic_snpeff.scores[, 20:29, 45]) : 'x' must be numeric
Data
str(No_Low_No_Intergenic_snpeff.scores)
'data.frame': 1000 obs. of 11 variables:
$ GEN.C00644.GT: Factor w/ 3 levels "0","1","2": 3 1 1 3 3 3 2 1 3 1 ...
$ GEN.C00647.GT: Factor w/ 3 levels "0","1","2": 3 1 3 3 2 2 2 1 2 1 ...
$ GEN.C00648.GT: Factor w/ 3 levels "0","1","2": 3 1 1 3 3 3 1 1 2 1 ...
$ GEN.C00649.GT: Factor w/ 3 levels "0","1","2": 3 1 1 3 2 2 2 1 2 1 ...
...