दिलचस्प पोस्ट
मैं 2 विभिन्न y- अक्षों के साथ कैसे साजिश कर सकता हूं? जब एक डुप्लिकेट कुंजी को एक हैशमैप में रखा जाता है तो क्या होता है? एंड्रॉइड स्टूडियो – अनपेक्षित शीर्ष-स्तर का अपवाद: मैक ओएस एक्स जावा अपडेट्स के लिए स्रोत कोड उदाहरण के साथ .net में निर्भरता इंजेक्शन? अजगर का उपयोग करके कताई कमांड लाइन कर्सर कैसे बना सकता है? किसी TForm को अन्य TForm में एम्बेड करते समय मुद्दों से कैसे बचें? ओपनसीवी 2.4.3 को विजुअल सी ++ 2010 एक्सप्रेस में स्थापित करना सी ++ सीमा पुनरावर्ती गहराई है? 'पुस्तकालय लोड नहीं किया गया है: @ rpath / libcudart.7.5.dylib' मैक पर TensorFlow त्रुटि मैक ओएस एक्स 10.6.4 पर अजगर 2.7 की स्थापना कैसे करें? एंड्रॉइड: Html.TagHandler का उपयोग कैसे करें? कम ज्ञात लेकिन उपयोगी डेटा संरचनाएं क्या हैं? एक प्रक्रिया और धागे के बीच अंतर क्या है? रेल संघ के तरीके कैसे काम करते हैं?

आर – निर्धारित अंतराल का काटा

क्या किसी भी अंतराल के बिना किसी निर्धारित अंतराल में कटौती करने के लिए आर में कुछ रास्ता है?

उदाहरण के लिए, यदि मैं सही अंतराल [1,10] में मान चाहता हूं; डिफ़ॉल्ट रूप से इस अंतराल को छोटे अंतराल में टूट जाता है।

Solutions Collecting From Web of "आर – निर्धारित अंतराल का काटा"

पूर्व-निर्धारित अंतरालों में कटौती करने के लिए, आप breaks पैरामीटर का उपयोग करके ब्रेक के एक वेक्टर निर्दिष्ट कर सकते हैं।

कुछ डेटा परिभाषित करें:

 x <- sample(0:20, 100, replace=TRUE) x 

अब 0, 10 और 20 पर एक्स कट:

 cut(x, breaks=c(0, 10, 20), include.lowest=TRUE) [1] (10,20] [0,10] [0,10] (10,20] (10,20] (10,20] [0,10] (10,20] (10,20] [10] (10,20] [0,10] (10,20] (10,20] (10,20] [0,10] (10,20] [0,10] [0,10] [19] [0,10] (10,20] [0,10] [0,10] [0,10] (10,20] [0,10] (10,20] (10,20] [28] (10,20] (10,20] [0,10] [0,10] [0,10] [0,10] (10,20] [0,10] [0,10] [37] [0,10] [0,10] (10,20] (10,20] (10,20] (10,20] [0,10] (10,20] [0,10] [46] (10,20] [0,10] (10,20] (10,20] [0,10] [0,10] (10,20] (10,20] (10,20] [55] [0,10] [0,10] (10,20] [0,10] [0,10] [0,10] [0,10] (10,20] (10,20] [64] (10,20] [0,10] [0,10] (10,20] (10,20] (10,20] (10,20] (10,20] (10,20] [73] (10,20] [0,10] [0,10] [0,10] (10,20] [0,10] (10,20] [0,10] (10,20] [82] [0,10] [0,10] (10,20] [0,10] [0,10] [0,10] (10,20] (10,20] [0,10] [91] [0,10] [0,10] (10,20] (10,20] [0,10] [0,10] [0,10] [0,10] (10,20] [100] (10,20] Levels: [0,10] (10,20] 

कुछ इस तरह? 0 से 1 तक प्रत्येक 0.2 के लिए ब्रेक

 > a <- runif(100) > cut(a, seq(from = 0, to = 1, by = 0.2)) [1] (0,0.2] (0.8,1] (0.8,1] (0.6,0.8] (0.6,0.8] (0,0.2] (0.6,0.8] [8] (0.2,0.4] (0.8,1] (0.4,0.6] (0.8,1] (0.4,0.6] (0.8,1] (0.6,0.8] [15] (0.8,1] (0,0.2] (0.8,1] (0.8,1] (0.6,0.8] (0.6,0.8] (0.2,0.4] [22] (0.4,0.6] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.6,0.8] (0,0.2] [29] (0,0.2] (0.2,0.4] (0,0.2] (0,0.2] (0,0.2] (0,0.2] (0,0.2] [36] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.8,1] (0.2,0.4] (0.4,0.6] [43] (0.4,0.6] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.6,0.8] (0.4,0.6] [50] (0.6,0.8] (0.6,0.8] (0,0.2] (0.2,0.4] (0.8,1] (0.8,1] (0.8,1] [57] (0.6,0.8] (0.2,0.4] (0.2,0.4] (0,0.2] (0.8,1] (0.8,1] (0.2,0.4] [64] (0.8,1] (0.2,0.4] (0.4,0.6] (0.8,1] (0,0.2] (0.4,0.6] (0,0.2] [71] (0.4,0.6] (0.8,1] (0.6,0.8] (0.4,0.6] (0,0.2] (0.2,0.4] (0.4,0.6] [78] (0,0.2] (0.2,0.4] (0.8,1] (0,0.2] (0.4,0.6] (0.8,1] (0,0.2] [85] (0,0.2] (0.2,0.4] (0.2,0.4] (0.4,0.6] (0.8,1] (0.2,0.4] (0,0.2] [92] (0.6,0.8] (0.2,0.4] (0.2,0.4] (0.8,1] (0.2,0.4] (0.4,0.6] (0,0.2] [99] (0,0.2] (0,0.2] Levels: (0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1]