How to reverse a vector in R?

Sometimes the vector values are recorded in the reverse order in R, therefore, we need to again reverse those vectors to get the actual order we want. For example, a sequence of numbers might be recorded as 1 to 20 but we wanted it to be from 20 to 1. The reversing of order of the vector values can be easily done with the help of rev function.

Examples

x1
Updated on: 2020-08-21T06:34:16+05:30

834 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements