Question: Submit an R program that allows the user to enter a numeric vector of arbitrary length. Use the runif function to select two random indices

  1. Submit an R program that allows the user to enter a numeric vector of arbitrary length. Use the runif function to select two random indices of the vector and swap the value at these two indices. You may assume that the entered vector has at least two elements.

An example of the program's execution follows.

Enter a vector of numbers: 4 5 6 8 9 3 2

Swapped vector: 4 5 3 8 9 6 2

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!