Write a function insrt that will take a vector x a position


Write a function insrt that will take a vector x, a position p, and a new value v, and insert the new value in the vector x at position p, by shifting the remaining elements to the right (the length of the vector will be increased by 1). For instance, if the function insrt were to be called on the vector x = c(1, 2, 3, 4, 5), with actual parameters p = 3 and v = 100, the result would be (1, 2, 100, 3, 4, 5). At this time, assume that the user will always provide a valid position (i.e., between 1 and the last position in the existing vector), and a valid value v.

Request for Solution File

Ask an Expert for Answer!!
Basic Statistics: Write a function insrt that will take a vector x a position
Reference No:- TGS02647844

Expected delivery within 24 Hours