Question: You have to solve it with R Write a function which takes one argument $x$ of length 2, and returns the ordered values of $x$.

You have to solve it with R

Write a function which takes one argument $x$ of length 2, and returns the ordered values of $x$. That is, if $x_2

Use your function to process a dataset with 2 columns as follows. Iterate over the rows of the data set, and if the element in the 2nd column of row *i* is less than the element in the first column of row *i*, switch the order of the two entries in the row by making a suitable call to the function you just wrote.

Test using the following data.

```{r} set.seed(1128719) data=matrix(rnorm(20),byrow=T,ncol=2)

data ```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!