Dell-EMC
E20-007 · Question #127
A data scientist is given an R data frame, "empdata", with the columns Age, Salary, Occupation, Education, and Gender. The data scientist would like to examine only the Salary and Occupation columns…
The correct answer is A. empdata[empdata$Age > 40,c("Salary","Occupation")]. See the full explanation below for the reasoning.
Question
A data scientist is given an R data frame, "empdata", with the columns Age, Salary, Occupation, Education, and Gender. The data scientist would like to examine only the Salary and Occupation columns for ages greater than 40. Which command extracts the appropriate rows and columns from the data frame?
Options
- Aempdata[empdata$Age > 40,c("Salary","Occupation")]
- Bempdata[c("Salary","Occupation"),empdata$Age > 40]
- Cempdata[Age > 40,("Salary","Occupation")]
- Dempdata[,c("Salary","Occupation")]$Age > 40
How the community answered
(64 responses)- A72% (46)
- B16% (10)
- C8% (5)
- D5% (3)
Community Discussion
No community discussion yet for this question.