← Back to R Course | Chapter 8: Data Manipulation | Lesson 6 of 7

table() का उपयोग

table count करता है हर value कितनी बार दिखती है, एक class election में votes tally करने की तरह। यह हर अलग choice के लिए एक neat count देता है।

In this page:

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

table()

table(x) count करता है कि एक vector में हर distinct value कितनी बार appear होती है, एक frequency table produce करते हुए। यह categorical data summarize करने का सबसे quick तरीका है। दो vectors pass करना, table(x, y), दोनों के combinations count करने वाला एक cross-tabulation produce करता है।

Note: deeper analysis से पहले एक categorical column में values की distribution check करने का सबसे fast तरीका table() है।

उदाहरण: table()

markup
colors <- c("red", "blue", "red", "green", "blue", "red")

print(table(colors))
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. यह उम्मीद करना कि table() एक plain vector return करेगा, जब यह names वाला एक table object return करता है।
  2. कई unique values वाला एक numeric column count करना, जो एक बहुत लंबा table produce करता है।
  3. NA values miss करना क्योंकि ये default से excluded हैं; useNA = "ifany" इस्तेमाल करें।
🔒

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.