Back to Course
R for Busy People (Cohort-0)
0% Complete
0/0 Steps
-
Installing R and RStudio1 Lesson|2 Quizzes
-
The RStudio IDE1 Lesson|2 Quizzes
-
Coding Basics1 Lesson|2 Quizzes
-
Assignment | Workshop 11 Quiz
-
Data dive: Ebola in Sierra Leone1 Lesson|2 Quizzes
-
RStudio Projects1 Lesson|2 Quizzes
-
Workshop 21 Lesson|1 Quiz
-
Using R Markdown1 Lesson|2 Quizzes
-
Data classes & structures (deprec)2 Lessons
-
Workshop 31 Lesson|1 Quiz
-
Select & rename1 Lesson|3 Quizzes
-
Filter1 Lesson|3 Quizzes
-
Workshop 41 Quiz
-
Mutate1 Lesson|3 Quizzes
-
Workshop 51 Lesson|1 Quiz
-
Conditional mutate1 Lesson|3 Quizzes
-
Group by and summarize1 Lesson|2 Quizzes
-
Workshop 61 Lesson|1 Quiz
-
Other grouped operations1 Lesson|2 Quizzes
-
Workshop 71 Lesson|1 Quiz
-
Intro to ggplot21 Lesson|2 Quizzes
-
Scatter plots and smoothing1 Lesson|2 Quizzes
-
Workshop 81 Lesson|1 Quiz
-
Lines, scales, and labels1 Lesson|2 Quizzes
-
Overview of the EpiGraphHub web platform
-
Data exploration on EpiGraphHub1 Quiz
-
Workshop 91 Lesson|1 Quiz
-
Workshop 101 Lesson|1 Quiz
-
Final project1 Lesson|1 Quiz
-
Getting help1 Lesson|1 Quiz
-
Quiz contributions16 Lessons
-
Quiz contributions: The RStudio IDE
-
Quiz contributions: Coding basics
-
Quiz contributions: Data dive | Ebola in Sierra Leone
-
Quiz contributions: RStudio Projects
-
Quiz contributions: R Markdown
-
Quiz contributions: Data classes & structures
-
Quiz contributions: Select & rename
-
Quiz contributions: Filter
-
Quiz contributions: Mutate
-
Quiz contributions: Conditional mutate
-
Quiz contributions: Group by and summarize
-
Quiz contributions: Other grouped operations
-
Quiz contributions: Pivoting data
-
Quiz contributions: Intro to ggplot2
-
Quiz contributions: Scatter plots and smoothing
-
Quiz contributions: Lines, scales and labels
-
Quiz contributions: The RStudio IDE
Participants 76
Topic 17 of 31
In Progress
Group by and summarize
🚗 Video too fast or too slow? Click the gear icon ⚙️ at the bottom-right to change the speed!
Lesson code
Please download the zip folder below to code along with the instructor.
You need to unzip this folder to code along. Or “Extract All” on Windows. See our video explanation of this if you are unsure.
Lesson notes
The written guide below is an accompaniment to the lesson video. You may read through it if you prefer written tutorials to video content.
👋 Before you go, please rate your satisfaction with this lesson
Ratings are completely anonymous
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.
Please share any positive or negative feedback you may have.
Feedback is completely anonymous
Topic Content
0% Complete
0/1 Steps
data quiz question: Could someone explain why I have Cov=4.2 instead of 0.015 ? Please see my codes below. covid_well_being_1 <- covid_well_being |> mutate(sleep_time=minutes_from_sleep_to_wake – minutes_awake_at_night) covid_well_being_1 sleep_time_and_stress <- covid_well_being_1 %>% group_by(respondent_id) %>% summarize (mean_sleep_time = mean(sleep_time, na.rm = T), mean_stress_levels = mean(stress_1_low_7_high, na.rm = T) ) sleep_time_and_stress sleep_time_and_stress |> signif(digits = 3) cov(x=sleep_time_and_stress$mean_sleep_time, y=sleep_time_and_stress$mean_stress_levels) |>… Read more »
Hi Samuel, I think it may be because you use cov () instead of cor (). I looked at chatGPT and it says cor () is used to compute the correlation coefficient between variables while cov () is used to compute the covariance between variables. Please try with cor () as we are… Read more »
Nice catch, Cicilia!
Samuel, apart from the small typo in your function name that Cicilia mentioned, your code looks good to me. I hope you are able to try the suggested solution and resolve the issue.
Joy, thank you. I have resolved the issue thanks to Cicilia. However, I have already submitted the data quiz and missed the related question.
Dear Tutor, could you please advise if we should use ungroup () function systematically after the group_by () and summarize () functions are being used? Thank you.
Hi Cicilia, good question. If you intend to use your summarized data frame for further manipulations — e.g., with mutate() or select() — you should add ungroup() after group_by() and summarize(), otherwise it will likely produce errors down the line. However, if you are creating a summary table which you don’t plan to… Read more »
Thanks for this advice, Joy. Very useful.
Hello Team. Could anyone explain why the question check said this is incorrect ?
Q_sum_bedridden_days <-
yao %>% group_by(sex) %>% summarize(total_bedridden_days = sum(n_days_miss_work, na.rm = TRUE))
Q_sum_bedridden_days
Hi Samuel, from your code, I could see that you use variable n_days_miss_work to calculate total bedridded_days. That’s why it’s incorrect. You may want to use n_bedridden_days instead.
thank you. Resolved
Requesting a support for the quiz on this lesson Dear Graph Team, I would ask a support from you about this quiz. I have done this quiz and I got 142,1% and I click on button “send” for submit it. We tell me that it’s submitted and it told me that I got… Read more »
Now the problem is resolved
Hello, please there seems to be a problem with how the system is checking the answers to the questions.
Sorry about the issue! This has now been fixed. Thanks for noticing.