टैग्स वाले पोस्ट्स को बाइंड करना और गिनना
पिछले अभ्यास में जो टेबल्स आपने बनाई थीं, वे questions_with_tags और answers_with_tags नाम से प्रीलोडेड हैं. पहले, इन टेबल्स को मिलाकर posts_with_tags नाम की एक सिंगल टेबल बनाइए. जब सारी जानकारी एक टेबल में आ जाए, तो आप lubridate पैकेज (जो आपके लिए प्रीलोडेड है) की मदद से एक date वैरिएबल बनाकर और जानकारी जोड़ सकते हैं.
questions_with_tags <- questions %>%
inner_join(question_tags, by = c("id" = "question_id")) %>%
inner_join(tags, by = c("tag_id" = "id"))
answers_with_tags <- answers %>%
inner_join(question_tags, by = "question_id") %>%
inner_join(tags, by = c("tag_id" = "id"))
यह अभ्यास पाठ्यक्रम का हिस्सा है
dplyr के साथ डेटा जॉइन करना
अभ्यास निर्देश
questions_with_tagsऔरanswers_with_tagsटेबल्स को मिलाकरposts_with_tagsबनाएँ.posts_with_tagsमें एकyearकॉलम जोड़ें, फिरtype,year, औरtag_nameके आधार पर पोस्ट्स को काउंट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Combine the two tables into posts_with_tags
posts_with_tags <- ___(questions_with_tags %>% mutate(type = "question"),
answers_with_tags %>% mutate(type = "answer"))
# Add a year column, then count by type, year, and tag_name
posts_with_tags %>%
___