Questions
COMM_V 205 101 102 103 2025W1 R Review Quiz
Multiple fill-in-the-blank
Please create the following data frame: library(tidyverse)student <- tibble( sid = c(66666,66666,66666,66666,66666,66666,22222,22222,22222,22222,22222, 11111,11111,11111,11111,11111,44444,44444,44444,44444,44444, 44444, 55555,55555,55555,55555,55555,55555, 33333,33333,33333,33333,33333,33333, 77777), course = c("COMM101", "COMM102", "COMM103", "COMM201", "COMM204","COMM205", "COMM101", "COMM102", "COMM103", "COMM201","COMM204", "COMM101", "COMM102", "COMM103", "COMM201", "COMM205", "COMM101", "COMM102", "COMM103", "COMM201","COMM204", "COMM205", "COMM101", "COMM102", "COMM103","COMM201", "COMM204", "COMM205", "COMM101", "COMM102", "COMM103", "COMM201", "COMM204","COMM205", "COMM205"), year = c(2016, 2016, 2016, 2017, 2017, 2017, 2016, 2016, 2017, 2017,2017,2016, 2016, 2016, 2017, 2017, 2016, 2016, 2016, 2016, 2017, 2017,2016, 2016, 2016, 2016, 2017, 2017,2016, 2016, 2016, 2017, 2017, 2017, 2017), grade = c(85, 88, 72, 67, 80, 90, 77, 77, 77, 77, 77, 78, 82, 82, 80, 90, 80, 80, 80, 85, 85, 85, 79, 80, 81, 82, 83, 84, 90, 88, 95, 80, 80, 80, 99)) You wanted to find out how many unique students have taken courses in 2016. student %>% filter(year == 2016) %>% XXXX(sid) %>% summarise(XXXX(sid)) The result of your code should look something like this: # A tibble: 1 × 1 XXXXXXXXXX <int> 1 6 Please complete the code below. student %>% filter(year == 2016) %>% [Fill in the blank] (sid) %>% summarise([Fill in the blank] (sid))
View Explanation
Verified Answer
Please login to view
Step-by-Step Analysis
We start by restating the problem in our own words to ensure we understand the task: we have a tibble of student course registrations with columns sid, course, year, and grade, and we want to count how many unique student IDs (sids) appear in the year 2016.
Option 1: select
- The first blank appears after filter(year == 2016) and before the next pipe to summarise. If we insert select(sid), we are narrowing the data frame to just the sid column for the 2016 observations.
- Keeping only sid is reasonable because we only care about distinct student identifiers; it reduces ......Login to view full explanationLog in for full answers
We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!
Similar Questions
This function in the library of Pandas allows you to manipulate data and create new variables (please choose all the correct answers, one or more):
Question at position 17 ________ is a set of commands used to update and query a database.DDL DML DPL DCL
Question at position 51 A database is maintained and queried using the data mapping language (DML).TrueFalse
Question at position 33 INSERT INTO is an example of ________ code.DDL DCLDMLTIO
More Practical Tools for Students Powered by AI Study Helper
Making Your Study Simpler
Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!