Questions
Questions

COMM_V 205 101 102 103 2025W1 Exam B2 (R) 2025W1 Final - Requires Respondus LockDown Browser

Single choice

Suppose you have a data frame called df with 10 observations. One of the columns is a character column called ID. The first value of ID is "01", the second is "02", and so forth. The 10th observation for ID is "10".   You then run the following code:   df %>%   mutate(ID_num = as.numeric(ID), ID_new = as.character(ID_num)) %>%   filter(ID != ID_new)   How many rows are displayed (outputted) in the result?  

Options
A.1
B.2
C.5
D.9
E.10
View Explanation

View Explanation

Verified Answer
Please login to view
Step-by-Step Analysis
The scenario involves a character column ID with values '01','02', ..., '10', and a dplyr pipeline that creates two new columns before filtering. Option 1: '1' is used when considering the numeric conversion of '01' to 1 and then back to a character '1'. Since '01' becomes '1' after the numeric round-trip, the comparison ID != ID_new yields '01' != '1', which is TRUE, so that row remains. Therefore this option would not correspond t......Login to view full explanation

Log 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!

More Practical Tools for Students Powered by AI Study Helper

Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!