1.

Which of the following sort a dataframe by the order of the elements in B?(a) x[rev(order(x$B)),](b) x[ordersort(x$B),](c) x[order(x$B),](d) x[rev(x$B),]The question was posed to me in a job interview.Question is from Commands topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct OPTION is (a) x[rev(order(x$B)),]

To ELABORATE: x[rev(order(x$B)),] SORT the dataframe in REVERSE order.



Discussion

No Comment Found

Related InterviewSolutions