题目
BSYS847_2025_V1 Assessment 1: In-Class Quiz
单项选择题
Consider a dataframe td_new. What does executing the following R Code acheive: grep("[B][u][s][h]", td_new$movie_title, value = T)
选项
A.This code will find instances (such as lines, cells, etc.) in the column movie_title that have the letter "T" and will replace it with "Bush".
B.This code will find instances (such as lines, cells, etc.) in the column movie_title, that have any combination of the word "BUSH" such as BUSH, USHB, USBH, etc.
C.This code will find instances (such as lines, cells, etc.) in the column movie_title, that have the word "Bush".
D.This code will find instances (such as lines, cells, etc.) in the column movie_title, that have the word "Bush", and will replace these with "T".
查看解析
标准答案
Please login to view
思路分析
We start by restating the question in our own words to ground the analysis: The R code grep("[B][u][s][h]", td_new$movie_title, value = T) is applied to the movie_title column of the data frame td_new, and it uses grep with value = TRUE. Now, let's evaluate each option carefully.
Option 1: 'This code will find instances (such as lines, cells, etc.) in the column movie_title that have the letter "T" and will replace it with "Bush".' This is incorrect for a couple of reasons. First, grep searches for patterns and returns the matching elements (or their indices), it does not perform replaceme......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
Question at position 22 Which of the following strings match(es) the regular expression in following command? grep “^[ABCa-z][23]” Notes.TXT ABCa-z2345x22345Ba32ABCAll of these.
Are the languages of the following regular expressions the same? (a|b)*(ab)* (a*|b*)*(ab)*
Are the languages of the following regular expressions the same? (a|b)* (b|a)*
Are the languages of the following regular expressions the same? a(bc)* ab*c*
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!