Vector in R programming is one-dimensional array. Its element can be numeric, character, or logital data. To create a vector…