PrepAway - Latest Free Exam Questions & Answers

Which command extracts the appropriate rows and columns from the data frame?

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?

PrepAway - Latest Free Exam Questions & Answers

A.
empdata[empdata$Age > 40,c(“Salary”,”Occupation”)]

B.
empdata[c(“Salary”,”Occupation”),empdata$Age > 40]

C.
empdata[Age > 40,(“Salary”,”Occupation”)]

D.
empdata[,c(“Salary”,”Occupation”)]$Age > 40


Leave a Reply