Remove Objects from Memory in R Programming - rm() Function Last Updated : 19 Jun, 2020 Comments Improve Suggest changes Like Article Like Report rm() function in R Language is used to delete objects from the memory. It can be used with ls() function to delete all objects. remove() function is also similar to rm() function. Syntax: rm(x) Parameters: x: Object name Example 1: Python3 1== # R Program to remove # objects from Memory # Creating a vector vec <- c(1, 2, 3, 4) vec # Creating a list list1 = list("Number" = c(1, 2, 3), "Characters" = c("a", "b", "c")) list1 # Creating a matrix mat <- matrix(c(1:9), 3, 3) mat # Calling rm() Function rm(list1) # Calling ls() to check object list ls() Output: [1] 1 2 3 4 $Number [1] 1 2 3 $Characters [1] "a" "b" "c" [, 1] [, 2] [, 3] [1, ] 1 4 7 [2, ] 2 5 8 [3, ] 3 6 9 [1] "mat" "vec" Example 2: Python3 1== # R Program to remove # objects from Memory # Creating a vector vec <- c(1, 2, 3, 4) # Creating a list list1 = list("Number" = c(1, 2, 3), "Characters" = c("a", "b", "c")) # Creating a matrix mat <- matrix(c(1:9), 3, 3) # Calling rm() Function # to remove all objects rm(list = ls()) # Calling ls() to check object list ls() Output: character(0) Comment More infoAdvertise with us Next Article Remove Objects from Memory in R Programming - rm() Function N nidhi_biet Follow Improve Article Tags : R Language R Object-Function Similar Reads Remove names or dimnames from an Object in R Programming - unname() Function unname() function in R Language is used to remove the names or dimnames from an Object. Syntax: unname(x) Parameters: x: Object Example 1: Python3 1== # R Program to remove names from an object # Creating a matrix A = matrix(c(1:9), 3, 3) # Naming rows rownames(A) = c("a", "b", 1 min read Remove Duplicate Elements from an Object in R Programming - unique() Function unique() function in R Language is used to remove duplicated elements/rows from a vector, data frame or array. Syntax: unique(x) Parameters: x: vector, data frame, array or NULL Example 1: Python3 # R program to illustrate # unique function # Initializing some set of numbers x <- c(1:10, 5:9) x # 1 min read Get the number of rows of an Object in R Programming - nrow() Function nrow() function in R Language is used to return the number of rows of the specified matrix. Syntax: nrow(x)Parameters: x: matrix, vector, array or data frame  Example 1:  Python3 # R program to illustrate # nrow function # Getting R Biochemical Oxygen Demand Dataset BOD # Calling nrow() function 1 min read Removing Levels from a Factor in R Programming - droplevels() Function droplevels() function in R programming used to remove unused levels from a Factor. Syntax: # For vector object droplevels(x, exclude = if(anyNA(levels(x))) NULL else NA, ...) # For data frame object droplevels(x, except, exclude) Parameter values: x represents object from which unused level has to b 2 min read Convert an Object to List in R Programming - as.list() Function as.list() function in R Programming Language is used to convert an object to a list. These objects can be Vectors, Matrices, Factors, and dataframes. Syntax: as.list(object) Parameters: object: Vector, Matrix, factor, or data frame R - as.list() Function ExampleExample 1: Converting Vector to list 2 min read Get the Maximum element of an Object in R Programming - max() Function max() function in R Language is used to find the maximum element present in an object. This object can be a Vector, a list, a matrix, a data frame, etc.. Syntax: max(object, na.rm) Parameters: object: Vector, matrix, list, data frame, etc. na.rm: Boolean value to remove NA element. Example 1: Python 1 min read Get the Minimum element of an Object in R Programming - min() Function min() function in R Language is used to find the minimum element present in an object. This object can be a Vector, a list, a matrix, a data frame, etc.. Syntax: min(object, na.rm) Parameters: object: Vector, matrix, list, data frame, etc. na.rm: Boolean value to remove NA element. Example 1: Python 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 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 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 Like