← Back to R Course | Chapter 9: Statistics | Lesson 4 of 7

cor() का उपयोग

cor measure करता है कि numbers के दो sets कितनी strongly साथ move करते हैं, जैसे क्या लंबे बच्चों के shoes बड़े होते हैं। Answer minus one से one तक चलता है।

In this page:

  1. cor()
Syntax
r
cor(x, y)

cor()

cor(x, y) दो numeric vectors के बीच Pearson correlation coefficient compute करता है, -1 और 1 के बीच एक value describe करते हुए ये linearly कितनी strongly साथ move करते हैं।

1 के पास एक value strong positive correlation मतलब है, -1 के पास strong negative correlation, और 0 के पास थोड़ा linear relationship। यह variables के बीच relationships explore करने के लिए एक foundational tool है।

Note: 0 के पास एक correlation मतलब यह नहीं कि कोई relationship नहीं -- इसका मतलब सिर्फ यह है कि कोई linear relationship नहीं है।

उदाहरण: cor()

markup
x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 6, 8, 10)

cat("Correlation:", cor(x, y), "\n")
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. cor(x, y) को इस proof की तरह पढ़ना कि x, y cause करता है, जब correlation cause नहीं दिखाता।
  2. अलग lengths के vectors pass करना, जो एक error देता है।
  3. use = "complete.obs" के बिना NA वाले data पर cor() इस्तेमाल करना, जो NA return करता है।
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.