Display the internal Structure of an Object in R Programming - str() Function Last Updated : 05 Jun, 2020 Comments Improve Suggest changes Like Article Like Report 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 used as an alternative to summary() but str() is more compact than summary(). It gives information about the rows(observations) and columns(variables) along with additional information like the names of the columns, class of each columns followed by few of the initial observations of each of the columns. Syntax: str(object, ...) Parameter: object: Any R object about which information is required. Example 1: Python3 # R program to display # structure of a list # Creating a list gfg <- list(2, 4, 5, 6, 7, 9, 13, 15, 3, 1) # Calling str() function str(gfg) Output: List of 10 $ : num 2 $ : num 4 $ : num 5 $ : num 6 $ : num 7 $ : num 9 $ : num 13 $ : num 15 $ : num 3 $ : num 1 Here, we can observe the output which is a description of the object gfg. It mentions that it is a list having 10 components. In the following rows, it displays each one of them along with their class i.e. numeric in this case. Example 2: Python3 # R program to display structure # of a pre-defined dataset # Importing Library library(datasets) # Importing dataset head(airquality) # Calling str() function str(airquality) Here, head(airquality) will display the first few rows of the data frame. After executing, the following output will be displayed. Output : Ozone Solar.R Wind Temp Month Day 1 41 190 7.4 67 5 1 2 36 118 8.0 72 5 2 3 12 149 12.6 74 5 3 4 18 313 11.5 62 5 4 5 NA NA 14.3 56 5 5 6 28 NA 14.9 66 5 6 'data.frame': 153 obs. of 6 variables: $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA ... $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 ... $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ... $ Temp : int 67 72 74 62 56 66 65 59 61 69 ... $ Month : int 5 5 5 5 5 5 5 5 5 5 ... $ Day : int 1 2 3 4 5 6 7 8 9 10 ... It provides us the information that the dataset airquality is a data frame with 153 observations(rows) of 6 variables(columns). Then it tells us about each variable one by one as follows, the first column with name Ozone is of type integer followed by few of its values and the second column is named Solar.R which is also of the integer type followed by few of its contents and so on. str() will be really useful when we are unsure about the contents of an object as it will help us take a quick preview of the contents and structure of the object. This will also help in revealing issues in the naming of the columns, class of the content, etc, if any exist. Comment More infoAdvertise with us Next Article Display the internal Structure of an Object in R Programming - str() Function A anupama0699 Follow Improve Article Tags : R Language R DataFrame-Function R Vector-Function R Object-Function R Matrix-Function +1 More 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 Get or Set the Structure of a Vector in R Programming - structure() Function 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:1 1 min read Convert an Object into a Vector in R Programming - as.vector() Function 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: Python3 1== # R program to convert an object to vector # Creating an array x <- array(c(2, 3, 4, 7, 2, 5), c(3, 2)) x # Calling as.vector() Function 1 min read Getting String Representation of the given Date and Time Object in R Programming - strftime() Function strftime() function in R Language is used to convert the given date and time objects to their string representation. Syntax: strftime(time) Parameters: time: specified time object Example 1:  Python3 # R program to illustrate # strftime function # Specifying a date and time x <- "2020-06-01 16 1 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 Print the Value of an Object in R Programming - identity() Function identity() function in R Language is used to print the value of the object which is passed to it as argument. Syntax: identity(x) Parameters: x: An Object Example 1: Python3 1== # R program to print # the value of an object # Creating a vector x <- c(1, 2, 3, 4) # Creating a list list1 <- list 1 min read Get or Set names of Elements of an Object in R Programming - names() Function names() function in R Language is used to get or set the name of an Object. This function takes object i.e. vector, matrix or data frame as argument along with the value that is to be assigned as name to the object. The length of the value vector passed must be exactly equal to the length of the obj 2 min read Print the Argument to the Screen in R Programming - print() Function print() function in R Language is used to print out the argument to the screen. Syntax: print(x, digits, na.print) Parameters: x: specified argument to be displayed digits: defines minimal number of significant digits na.print: indicates NA values output format Example 1: Python3 # R program to illu 2 min read Convert an Object to a Table in R Programming - as.table() Function as.table() function in R Language is used to convert an object into a table. Syntax: as.table(x) Parameters: x: Object to be converted Example 1: Python3 1== # R Program to convert # an object to a table # Creating a vector vec = c(2, 4, 3, 1, 2, 3, 2, 1, 4, 2) # Calling as.table() Function as.table 1 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 Like