table() का उपयोग
table count करता है हर value कितनी बार दिखती है, एक class election में votes tally करने की तरह। यह हर अलग choice के लिए एक neat count देता है।
In this page:
Syntax
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()
colors <- c("red", "blue", "red", "green", "blue", "red")
print(table(colors))
Login to try C/C++/Java/PHP code in the editor
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. #}
आम गलतियां
- यह उम्मीद करना कि
table()एक plain vector return करेगा, जब यह names वाला एक table object return करता है। - कई unique values वाला एक numeric column count करना, जो एक बहुत लंबा table produce करता है।
NAvalues miss करना क्योंकि ये default से excluded हैं;useNA = "ifany"इस्तेमाल करें।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: