मैं rRna_RDP_taxonomy_phylum नामक एक फ़ाइल में निम्न डेटा के साथ है:आर त्रुटि "योग कारकों के लिए सार्थक नहीं"
364 "Firmicutes" 39.31
244 "Proteobacteria" 26.35
218 "Actinobacteria" 23.54
65 "Bacteroidetes" 7.02
22 "Fusobacteria" 2.38
6 "Thermotogae" 0.65
3 unclassified_Bacteria 0.32
2 "Spirochaetes" 0.22
1 "Tenericutes" 0.11
1 Cyanobacteria 0.11
और मैं आर में एक पाई चार्ट बनाने के लिए इस कोड का उपयोग कर रहा हूँ:
if(file.exists("rRna_RDP_taxonomy_phylum")){
family <- read.table ("rRna_RDP_taxonomy_phylum", sep="\t")
piedat <- rbind(family[1:7, ],
as.data.frame(t(c(sum(family[8:nrow(family),1]),
"Others",
sum(family[8:nrow(family),3])))))
png(file="../graph/RDP_phylum_low.png", width=600, height=550, res=75)
pie(as.numeric(piedat$V3), labels=piedat$V3, clockwise=TRUE, col=graph_col, main="More representative Phyliums")
legend("topright", legend=piedat$V2, cex=0.8, fill=graph_col)
dev.off()
png(file="../graph/RDP_phylm_high.png", width=1300, height=850, res=75)
pie(as.numeric(piedat$V3), labels=piedat$V3, clockwise=TRUE, col=graph_col, main="More representative Phyliums")
legend("topright", legend=piedat$V2, cex=0.8, fill=graph_col)
dev.off()
}
मैं अलग डाटाफाइलों के लिए इस कोड का उपयोग किया गया है और यह ठीक काम करता है, लेकिन फाइल के साथ एडोब प्रस्तुत यह निम्न संदेश लौटने दुर्घटना:
Error in Summary.factor(c(6L, 2L, 1L), na.rm = FALSE) :
sum not meaningful for factors
Calls: rbind -> as.data.frame -> t -> Summary.factor
Execution halted
मुझे यह समझने की जरूरत है कि यह इस फ़ाइल के साथ क्यों दुर्घटनाग्रस्त है और यदि इस तरह की त्रुटियों को रोकने के लिए कोई तरीका है।
धन्यवाद!
'योग (कारक (1)) 'त्रुटि को पुन: उत्पन्न करता है। लेकिन आपके पास इस डेटा में कारक क्यों हैं। फ्रेम और दूसरों में नहीं? आप अपना डेटा कैसे पढ़ते हैं? – agstudy
@smci कृपया आर –
@MatthewLundberg में कारकों के लिए [कारक] टैग का उपयोग न करें: गॉचा, पता नहीं था। मुझे सामानों का एक गुच्छा पीछे हटना होगा। चूंकि फैक्टर भाषा आर कारक से कम लोकप्रिय है, मुझे लगता है कि इसमें टैग [टैग: कारक-भाषा] होना चाहिए। मैं इसे मेटा पर उठाऊंगा। – smci