दिलचस्प पोस्ट
स्पष्ट त्वरण – यह कब उपयोग किया जाता है? कैसे काम करता है अजगर सूची टुकड़ा के साथ काम करता है तालिका पंक्ति पर स्लाइडडाउन (या शो) फ़ंक्शन कैसे उपयोग करें? कैसे एक बहुआयामी सरणी समतल करने के लिए? जेनेरिक सूची / डेटाटाले के लिए एन्यूमेरेबल कन्वर्ट? अजगर 3 में स्थान के बिना प्रिंट करें Javax.swing टाइमर ठीक दोहराता है, लेकिन ActionListener कुछ भी नहीं करता है अंतिम काम के लिए सी लूप अनुकूलन सहायता कस्टम सूचना लेआउट और पाठ रंग स्लैश (/) बनाम टिल्ड स्लैश (~ /) asp.net में शैली पत्रक पथ में जांचें कि जावास्क्रिप्ट PHP के साथ सक्षम है या नहीं आर में फ़ंक्शन को संपादित करने के लिए कौन से तरीके हैं? टेम्पलेट केवल हेडर फाइल में क्यों लागू हो सकते हैं? जावास्क्रिप्ट के eval को JSON डेटा eval करने के लिए कोष्ठक की आवश्यकता क्यों है? Lat / lon + किमी दूरी के साथ काम करने के लिए सरल गणना?

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

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

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

वेब के समाधान से एकत्रित समाधान "आर – निर्धारित अंतराल का काटा"

पूर्व-निर्धारित अंतरालों में कटौती करने के लिए, आप 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]