Get or Set the Structure of a Vector in R Programming - structure() Function Last Updated : 25 Jun, 2020 Comments Improve Suggest changes Like Article Like Report structure() function in R Language is used to get or set the structure of a vector by changing its dimensions. Syntax: structure(vec, dim) Parameters: vec: Vector dim: New Dimensions Example 1: Python3 1== # R program to get # the structure of a Vector # Creating a Vector # of Numbers x1 <- c(1:10) structure(x1) # Creating a vector # of strings x2 <- c("abc", "cde", "def") structure(x2) Output: [1] 1 2 3 4 5 6 7 8 9 10 [1] "abc" "cde" "def" Example 2: Python3 1== # R program to change # the structure of a Vector # Creating a Vector x <- c(1:10) x # Changing the structure of vector y1 <- structure(x, dim = c(2, 5)) y2 <- structure(x, dim = c(5, 2)) y1 y2 Output: [1] 1 2 3 4 5 6 7 8 9 10 [, 1] [, 2] [, 3] [, 4] [, 5] [1, ] 1 3 5 7 9 [2, ] 2 4 6 8 10 [, 1] [, 2] [1, ] 1 6 [2, ] 2 7 [3, ] 3 8 [4, ] 4 9 [5, ] 5 10 Comment More infoAdvertise with us Next Article Get or Set the Structure of a Vector in R Programming - structure() Function N nidhi_biet Follow Improve Article Tags : R Language R Vector-Function Similar Reads Get or Set the Type of an Object in R Programming - mode() Function mode() function in R Language is used to get or set the type or storage mode of an object. Syntax: mode(x) mode(x) <- value Here "value" is the desired mode or âstorage modeâ (type) of the object Parameters: x: R object Example 1: Python3 # R program to illustrate # mode function # Init 1 min read Generating sequenced Vectors in R Programming - sequence() Function sequence() function in R Language is used to create a vector of sequenced elements. It creates vectors with specified length, and specified differences between elements. It is similar to seq() function. Syntax: sequence(x) Parameters: x: Maximum element of vector Example 1: Python3 1== # R program t 1 min read Display the internal Structure of an Object in R Programming - str() Function str() function in R Language is used for compactly displaying the internal structure of a R object. It can display even the internal structure of large lists which are nested. It provides one liner output for the basic R objects letting the user know about the object and its constituents. It can be 3 min read Getting and Setting Length of the Vectors in R Programming - length() Function In R, the length() function is used to determine the number of elements in a vector. Vectors can be of various types, such as numeric, character, or logical, and the length() function provides a simple way to find out how many elements are contained in a vector. This function is versatile and can al 5 min read Search and Return an Object with the specified name in R Programming - get() Function get() function in R Language is used to return an object with the name specified as argument to the function. This is another method of printing values of the objects just like print function. This function can also be used to copy one object to another. Syntax: get(object) Parameters: object: Vecto 1 min read Like