VOOZH about

URL: https://www.geeksforgeeks.org/r-language/convert-an-object-into-a-vector-in-r-programming-as-vector-function/

⇱ Convert an Object into a Vector in R Programming - as.vector() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Convert an Object into a Vector in R Programming - as.vector() Function

Last Updated : 15 Jul, 2025
as.vector() function in R Language is used to convert an object into a vector.
Syntax: as.vector(x) Parameters: x: Object to be converted
Example 1: Output:
 [, 1] [, 2]
[1, ] 2 7
[2, ] 3 2
[3, ] 4 5
[1] 2 3 4 7 2 5
Example 2: Output:
 [, 1] [, 2] [, 3]
[1, ] 1 4 7
[2, ] 2 5 8
[3, ] 3 6 9
[1] 1 2 3 4 5 6 7 8 9
Comment

Explore